My Blog

Stuff that I've written

Have no fear, update is here.

Jan. 21, 2019, 9:09 a.m.

Last Friday I had some spare time and did some work on Makro. Nothing major though but rather some small updates. I added a loading spinner component which I then used to indicate the user that something is still loading. I have been planning to do that for a while but for some reason, I hadn't done that. 

Another small thing I added was that the search bar for foods is now focused by default so the user can start typing as soon as the bar is shown to start searching for foods instead of having to click on it first. Small thing but it was kinda a pain in the ass before. One extra click can make a major difference. on user experience.

What else? Oh yeah. The about page now displays the total number of registered users and the number of foods in the database.

I also fixed a bug that has been around for a while now. Sometimes when the user tried to share a day they had made it did not work because for some odd reason the component in question did not have the user's info and username is required when I save it to the database (only to be able to show to the user what has he/she shared previously on profile page). I added a fallback, so to speak, to the back end which will get the username from the JWT that is added to each HTTP-request. Should have done that a long time ago.

The last thing I did was an update to Angular 7 from Angular 6.

Comments: 0

Leave a comment


Jan. 14, 2019, 9:14 a.m.

The beginning of this year has been rather slow regarding programming. To be completely honest I haven't coded anything at all. I did do Wes Bos' Advanced React course but that's it. Why is that the case then?

First of I was on vacation during the first week of this year. The second week of this year I was back at work but I wasn't assigned to any project so didn't really have any work to do. So I did the React course.

Beyond that, I've been focusing on my book. I have enjoyed writing it a lot. It's almost "ready" in the sense that the main storyline is almost finished. But of course, there is still a lot to do. At the moment the book is about 300 pages (A5) with the font being Arial and size 12. Line spacing is 1.5. Word count is almost 30 000. I am aiming for 40 000 words because at the moment it does kinda feel a bit short. It's really hard to estimate how long it actually should be.

I'm hoping to finish it before the end this month. At least to a point where I can try sending it to a publisher and see what they think of it. I don't have high hopes though. At WSOY, about 0,2% of the manuscripts they receive gets published. Worth a shot though.

I haven't forgotten Makro completely though. I got a couple of things planned for it which I am going to do as soon as I'm done with the book.

Comments: 0

Leave a comment

End of the year

Dec. 31, 2018, 11:46 a.m.

2018 was a year of big things. I graduated from school at the beginning of summer and I got a job as a software engineer at the beginning of March.

By actually being able to program for a living has been great. I have learned so much during these 9 months.

I don't actually have anything else to say to be honest. laugh I haven't been programming much lately. Learning a bit of React for work and that's about it. I've just been relaxing and enjoying other stuff.

But even though I have not written code, I've tackled a new project that involves writing which is a book. But there isn't much to it so far (about 80 pages). I might write more about it here if it actually turns out to be something good.

Happy New Year!

Comments: 0

Leave a comment

Out Of Memory

Dec. 18, 2018, 1:15 p.m.

It finally happened. My droplet ran out of memory. All I did was add two new microservices and that did it. According to htop I still had around 50mb free RAM, but the databases this site uses crashed and did not want to start again. It wanted more memory.

So I closed my wow-tool and mockup catering site just to get things running again. I'm still trying to survive without having to buy more RAM since it would double the monthly bill which sucks.

Unfortunately the tinymce variant I am using in Makro does not support image uploading which means that I'd have to find an alternative for that if I want my users to be add pictures to the articles they write. I might do it someday but not right now.

And I had another setback as well. I set up virus scanning as a REST API using Node.js and ClamAV inside a Docker container but that, too, was too much for my droplet. Processor was constantly at 100% and nothing worked. Goodbye security. Kinda.

At the moment the database is only inside the docker container so I am hoping that will be enough for now. Oh and the datebase is separate from the main database just in case.

Comments: 0

Leave a comment

Service industry

Dec. 11, 2018, 9:25 p.m.

Almost a week ago I wrote about not being able to start coding. Luckily those days are far gone. After that post, I have been more productive than ever. Possibly. Well, I've been productive.

I talked about developing a couple new features and by the time I'm writing this I'm almost done with those. One is ready (for now) and the other is ready-ish. The one that is ready was a feature to allow users to create PDF files from their planned day. The PDFs are generated completely on front-end from the HTML. Before you get too excited, no, I did not write it myself but used libraries for that. I found these awesome libraries called "jsPDF" and "jsPDF-autotable" which made creating PDFs a breeze. Sort of. Of course, there were a couple of hiccups during the development process but it went smoothly enough for me to call it a breeze. At first, I was planning to generate the PDFs in the backend but decided against it. I'll rather use the computing power the user has instead of my rented one. This way it won't affect other users and no need to transfer files over HTTP. So it's a win-win.

The other new feature that I am currently in the process of developing is called articles. It is meant for users to write articles related to food and fitness. I'm trying to build an active social community around Makro and for that, I need ways for users to post content and interact with each other.

I tackled a new concept, so to speak, with this new service and that was uploading / downloading images for those written images. So far I have managed to get the header image to be uploaded (and downloaded) but I want my users to be able to add pictures into the article itself. I think I can use the current rich text editor, "angular2-tinymce", which I have for that. But first I need to figure how to allow file uploads for only one editor and not for all the places where the editor is used. For storing the images to the database I am using "multer", "multer-gridfs-storage" and "gridfs-stream". After I figure out a way to allow image upload for one editor only, I need to create another new service which I am going to use for virus scanning. And for virus scanning, I was planning to use ClamAV.

After I am done with those, Makro would have a backend which consists of five microservices. And I am going to do at least two more after done with these. I want to separate QA to its own microservice and have one service which handles the likes.

Oh, and still no TypeScript in the backend. Maybe someday.

Comments: 0

Leave a comment

I got 99 problems but time ain't one

Dec. 5, 2018, 3:52 p.m.

During the past month or so I have had some issues with developing Makro. Or actually programming anything but work. Before yesterday the latest commit was 23 days ago and that is unforgivable. At least for me it is. The problem has been more with starting to code than coding itself.

I have been working quite a lot during the past three weeks but that's a lame excuse. I have had plenty of time to further develop Makro but yet I have failed to do so. Luckily yesterday I actually managed to do something. I did the splitting of food related stuff to it's own service and did some other (minor) stuff as well.

As soon as I actually manage to start the programming it's fun and enjoyable. But the getting started part has been a bit too big of an obstacle lately. Time to fix that somehow.

In other news, having had a three week break of Makro had some interesting effects. Navigating the codebase was surprisingly hard even though I have written it all by myself. It's amazing how big of an effect such a short break can have. But it shouldn't be that big of a deal. I expect it all come back to me if (and when) I keep coming back to Makro more often.

I have also pondered about migrating the whole backend to use TypeScript. One service after another. I think I could do that after I implement these couple new features that I have planned in my mind already. Or if I'd be smart I'd do it for the one new service I'm going to do. But since I do know myself a bit too well I don't think that's going to happen.

Time will tell.

Comments: 0

Leave a comment

Macro services

Nov. 23, 2018, 6:23 a.m.

Yeah, that was a very bad pun. Sometimes it's kinda hard to come up with a funny title that is actually related to the stuff I write about. Sometimes means about 99% of time here. Oh the pressure. But I digress.

So I did split my authentication to it's own service and I am planning to do that for food -related stuff, too. Well, technically the whole site is related to food but I mean managing actual food items here. By doing that I have made the two of my most used 'services' to be actually their own services. Most likely it is completely unnecessary optimization but who knows. Makro has been growing slowly but surely and by the time I am writing this it has 226 registered users and of those 226 about 20 are active users. I know it's not that much and a single Node.js server can handle that kind of load more than well. But for me it's about learning stuff and for that Makro is a perfect platform. It keeps getting bigger (and better) and I can try out new things with actual users.

I have been working quite a lot lately and that is mainly because I am learning to do backend development with Java. So far it's been great and I have enjoyed it a lot. Even though it's really frustrating to try to understand what is happening and especially why it is happening. But it gets better day by day and so do I.

I've actually gotten to a point that I'd like to use Java for Makro (or something else) as well but realistically it is not an option for me. Unless I decide to upgrade my droplet to have more RAM (which I am going to do eventually but not just yet) because Spring Boot does use quite a lot RAM compared to Node.js for example. Sure you can tweak it but I still feel it would be a kind of an overkill to use it in this context. There is no heavy computing involved or need for multithreaded operations since my backend as a whole is basically just a REST API.

But this is might not always be the case and to be honest I do have a feature planned where I might want to use something else than Node.

As I'm trying to learn more about this microservices architecture I have found out that I probably should use separate databases for each of my services so they'd be as independent as they can be and could be deployed individually. This wouldn't be too big of a changes to implement but I'm not sure if I want to just keep adding more and more docker containers to my puny droplet. It is already a bit too close to use all of it's RAM and upgrading it would double the cost of the droplet which I am not ready to do. At least not just yet.

Comments: 0

Leave a comment

Internal server error

Nov. 15, 2018, 10:31 a.m.

I wrote this long ass post about splitting the authentication to it's own microservice and how it went smoothly etc. I also told how Makro has grown quite rapidly lately and is up to 220 registered users and there are more than 1900 foods in the database.

Then I hit save and got internal server error and it was gone. Since I really don't feel like typing it all over again this will have to do for now.

Comments: 0

Leave a comment

How do you like them apples?

Oct. 25, 2018, 9:29 p.m.

I've been quite busy with work during this week so only progress I've made with Makro is only a couple typo fixes, one bug fix and I created a new service for getting likes instead it being inside qaService since user can now vote on meals shared by other users. And while typing that I realized that that is actually a new feature I have developed since my last blog post.

So I made it possible to vote on meals shared by others users. That's about it. Implementation of it was fast and easy since the functionality was pretty much there because of QA section. While I did that I also did some changes on profile page. I moved the likes from QA section to it's own section since it's not tied to it anymore.

Another change that I have made recently was a switch from PC to Mac. I was not really planning to do that but since I don't really have time to play games (or I have a bit more of my own time these days but at the moment I'd rather spent it on programming) so I decided to sell my GPU. At first I was planning to sell the whole PC but decided against it because I could still keep using it for my coding. Unfortunately for some reason the PC in question stopped working after removing the GPU (second time) and after few hours of swearing and sweating I decided to abandon it completely. At least for now. Now I got my Mac plugged into my lovely screen (Dell U3415W) and I'm still using my mechanical keyboard. I just had to reorder some of the keys for it to function a bit better with Mac.

A great part of this week has been spent on learning/doing backend development with Java and Spring Boot combination. My colleague is sort of mentoring me which is great. Finally I've gained a bit more understanding on Java/SB. I'm still quite far away being fluent, so to speak, with it but I'm getting better every day.

Comments: 0

Leave a comment

Just Expressing myself

Oct. 19, 2018, 9:02 a.m.

Unfortunately I haven't really had time to make that much progress with Makro lately since other parts of my life have been keeping me a bit busy. But fear not, though. I have made some progress nevertheless. I did do the profile page redesign but not the admin page. The redesign for admin page isn't really a high priority task since I am the only admin so it doesn't really matter what it looks like because I'll be the only one looking at that.

The profile page is now divided to 5 sections: user information, planned days, shared meals, added foods and Q&A. From those the Q&A part is divided to four sections: questions, answers, comments and likes. I wanted to do this resign because the profile page was getting a bit too cluttered and opening it would make a plenty of API calls even if the user wanted to his/her information. Don't want to overload my little Node server. 

Besides that I have fixed some UI bugs and added one new feature that a user requested which was the possibility to copy food from a meal to another. But that functionality is not quite finished yet since I want users to be able to just drag the food to another meal to copy it so it would be a bit faster. Now it's done via modal by selecting the food you want to copy and the meal you want to copy it to. I only made it that way first because I just couldn't figure out the UI for it yet and didn't really have time to think about it too long. The space for the so called meal table is limited and quite full as is so adding new buttons just makes it cramped. But I'll make it work in the future. Funny thing is that the actual implementation is not the hardest part at the moment but the UI design.

What else? The code base is a bit over 11k LoC now. Yeah I know. It's a rather pointless thing to look at but hey it's something.

Oh yeah and one thing before I forgot to mention it. I finally fixed a bug that prevented unregistered users to not be able to access (or rather get) the day shared via link. It always returned unauthorized even though I had not intended to do that.

I had a method on routes related to sharing days that would check if the user can access the resource or not.

return (req, res, next) => {

if (req.path.includes('/pathtogettheday/') && req.method === 'GET') {


} else {



When I started debugging I noticed that that method was never executed for some reason. That was really confusing because the routes that were supposed to be protected actually were protected. So what gives? surprise

The fault here was combination of my laziness and how Express handles routing. Because I was lazy I had defined my most of my routes to be at /api/v1/theactualroute which led to that Express used the first route (file, which in this case was foods) to check the authorization. There was only one route that wasn't protected which sure wasn't for get the shared day and thus returned the unauthorized error if the user was not logged in. After discovering that the fix was quite simple: I just had to define my routes like a sane person would do. So instead everything being behind /api/v1/ they are now divided like the should've been from the beginning. So for example if you want to get the foods you would make the call to /api/v1/foods/ and so on. cool

The things you learn by making stupid mistakes. blush


PS. I have had this site (the Django version of it at least) since April and it took me this long to find the emojis.

Comments: 0

Leave a comment

Ask and you shall receive

Oct. 9, 2018, 9 a.m.

I noticed last friday while deploying new version of Makro to production that the codebase is now over 10 000 lines of code which is a personal record of mine. I hadn't really thought about the size of Makro that much lately. I've been just furiously developing new features and trying to deploy them each friday to production. Each friday being twice in this case. :)

But yeah. It sure has grown and gotten a lot bigger than I initially thought it would get. And for me that is really nice. I wasn't so sure if I'd ever manage to make a personal project go over 10k LoC. And it is going to get even bigger still.

So last friday I deployed Q & A to production like I said and it ended up being quite nice. The functionality of it is heavily inspired from Quora. But even though I did deploy it it's not ready yet. I have to add possibility to edit and delete stuff and make all user votes, comments, questions and answers to be show in profile page and so on. And on top of that I want to split the profile page in to pages so it isn't so cluttered and to avoid unnecessary API calls.

But back to the Q & A service. So far when I've been developing new features or fuctionality I haven't had to do that much thinking about how to implement it in the backend. It's been rather basic; handle the request, get data from DB and return it frontend. This time it was a bit different because I wanted user to be able to vote on answers and comments, comment on answer, reply to a comment and I wanted it to remember what the user had already voted.

At first I thought I'll store both the comments and votes on the answer (MongoDB) document but then I read that it will cause some performance issues if the he arrays where I'd store comments and votes would be updated often. And eventually the document would exceed it's maximum size which is 16mb if I remember correctly.

Then I made a separate collection for comments and then a new one for votes as well. Now each comment is stored as a single document which contains the postId that it is related to and if it is reply to a comment it will have replyTo key-value -pair that containes the username of the comment author that it is a reply to. The votes work quite similiary. Vote object is contains postId, userId and the actual vote. 

Now both the comment and answer contain only pointsTotal which is updated when the user votes something.


In the future I probably will split the Q&A -part as it's own microservice just like the authentication part of the app. This is because of the sister app I'll start developing as soon as I'm done with this. Done in this case might mean that when I'm done with the profile and admin panel page redesign and with the missing features of the Q&A service.

And a couple other new small-ish features that I want to add. To be honest I'm not in a hurry with starting to code the sister app since I am enjoying this way too much and I want this to be a great (free) replacement for services like MyFitnessPal, FatSecret and Sulamo.

Comments: 0

Leave a comment

A drop in the ocean

Oct. 2, 2018, 9:10 a.m.

Last night I moved this site to my new droplet and buried the old droplet that used to host all my projects. During the past month I've been moving (and dockerizing everything while doing it) to a brand new droplet. I had everything installed directly to the old droplet etc so in the end it ended up being kind of a mess. And on top of that I had increased the disk size to 30gb iirc so the price was a lot more than my new basic one which still has about 7gb space left of the 25gb provided after setting up all my projects.

Dockerizing this site (Django projcet) wasn't that difficult but I found it rather weird that one couldn't host the static files (.css etc) with gunicorn but had to setup a separate nginx for them. That caused a bit of confusion and delay while setting everything up. Oh and looks like mysql needs more RAM to work since I couldn't get it up inside container. It just crashed immediately with memory error. I switched to mariaDB and everything worked perfectly.

Now my new droplet is home of 4 different projects which all have them separate DBs and running inside docker containers. 1 vCPU seems to be more than enough for them but I might have to add more RAM to the server in the near future. Currently RAM usage is hovering around 700mb and the total is 990mb. So adding this site increased the RAM usage by 60-80mbs.

At the moment I am working on new features for Makro and planning a so called sister app for it as well. I might start working on it after I'm done with the planned Q&A portion for Makro. I want it to be kind of like Quora but for more specific topics like food and fitness in general and I'm hoping it will add a bit of social aspect to Makro. 

Comments: 0

Leave a comment

To production and beyond it!

Sept. 26, 2018, 8:45 a.m.

Last thursday I pushed the brand new Makro to production so to speak. It actually went rather smoothly since I already had figured out what I need to do when setting up docker-compose file etc. The only problem that surfaced was that the Lets Encrypt companion app for the jwilder nginx reverse proxy wasn't able to get certificates. It took me a couple of minutes to realize why that was the case. It was because I already had existing certificates to that address on a diffrent serve. Duh. So it was an easy fix: just removed the old ones.

Version 2 turned out to be quite nice in the end and I am rather happy with the end result. That doesn't mean that I don't have any new development planned for it. I've got actually a new feature in mind which I'm gonna tackle next and I will probably merge my whole fitness platform idea to Makro as well. But if I decide to do that I will have to first separate the authentication to its own (micro)service just to keep things a bit neater.

I also dockerized Makro and moved it to my new server. Only thing left to dockerize and move to the new server is this site. When I find the time and the motivation to do it I can finally get rid of this old server. But most likely I will just spend my free time developing Makro instead.

Comments: 0

Leave a comment

Drop a like

Sept. 20, 2018, 10:30 a.m.

Last night I managed to do something that I'm really excited about. Ever since I developed Makro I've wanted it to have a feature which I got working for the next version. The feature in question is drag and drop. More specifically being able to drag a food that has been added to a meal to a new meal. It really does not sound anything special but like a year ago I just couldn't wrap my head around it. I mean I didn't even try properly but to be honest I don't think I would have managed to do it anyways.

So let me set up the scenario. Each meal is its own component and those are dynamically created based on if the user adds food to that meal. So basically it's just a ngFor-loop. Then the user realizes that he/she added the food to a wrong meal and before the only way to do it was to add it again to the correct meal and remove it from the other one. Now the user is going to be able to just drag the food to another meal-component. And that is quite cool in my very subjective opinion.

First I added (drop)="drop($event)" and (dragover)="allowDrop($event)" to the table and draggable="true" (dragstart)="drag($event, food)" to the row which contains the food information. When I got it working my wife immediately noticed a bug. When dragging the food and letting go while still inside the same table (=meal component) it would delete the food. That happened because when moving the food I had add it to the new array, then remove it from the array where it was and calculate totals. While doing that I did not make sure that the source and target is not the same because then the food would just be removed from the food array and not really being added to anywhere. The source and target were decided based on the row id which was set up with []="i" (i being index of ngFor-loop).

That was an easy fix though. Just check if the source and target (still based on the row id) and do nothing if that is the case. But my wife already had submitted a new request regarding to that. She wanted to be able to rearrange the foods inside the meal. So now I had to come up a way to find out where exactly the dragged food was dropped. Enter a new event handler: (mouseenter)="setTarget(i)". So basically when the mouse enters a row it sets the dropTargetIndex to be the index of the food inside the array. However that wasn't enough though because when you are dragging something the mouse enter event is not triggered until you release the food you were dragging. I worked around this by inserting a timeout of 10ms which is enough for the dropTargetIndex to be updated to new value but not enough for user to move their mouse.

In the end it looks like this:


<table *ngIf="meal?.foods.length > 0" (drop)="drop($event)" (dragover)="allowDrop($event)">

<tr *ngFor="let food of meal.foods; let i = index">

<th class="t-head drag" scope="row" draggable="true" (dragstart)="drag($event, food)" []="i" (mouseenter)="setTarget(i)">


setTarget(index) {

  this.dropTargetIndex = index;



drag(ev, food) {

  ev.dataTransfer.setData('food', JSON.stringify(food));

  ev.dataTransfer.setData('index', this.componentIndex);




drop(ev) {

  const food = JSON.parse(ev.dataTransfer.getData('food'));

  const mealName =;

  const index = ev.dataTransfer.getData('index');

  const start = ev.dataTransfer.getData('start');

  if (parseInt(index) === parseInt(this.componentIndex)) {

    setTimeout(() => {

      this.meal.foods.splice(start, 1);

      this.meal.foods.splice(this.dropTargetIndex, 0, food);


    }, 10);


  } else {

    this.addedFoodsService.moveFoodToNewMeal(food, mealName, index);




allowDrop(ev) {



Comments: 0

Leave a comment

When the dust settles

Sept. 14, 2018, 9:53 a.m.

It's now been ten days since I emerged victorious from my battle with Docker and the stuff related to that. So what I have been up to since?

I started remaking Makro - the calorie counter that I developed about a year ago with MEVN stack. This time I'm doing it with MEAN stack so not much change there. Basically just a transition from Vue to Angular. And to be completely honest there is not going to be THAT much changes to be made in the backend. Just some minor modifications to some of the models and added a bit more security so that pretty much all of the endpoints are behind authorization except for login and register (for quite obvious reason) and the endpoint to get all foods. Oh and JWT token expiration is down from 7 days to 1 day and that is going to be actually checked. Yeah, it wasn't before so basically it never expires. Yay me.

I just remembered that I am going to make an admin panel for myself so that is actually going to require some work in the backend as well.

But most of the changes are going to be in frontend if for nothing else than switching from Vue to Angular (duh). There is not going to be that much changes to the actually UI (and UE) but more so to the functionality of it. So if any of my current users happens to read this you don't have that much to worry about. The biggest changes in UI are probably going to be in the modals and in the profile page which are modernized.

As of today I have most of the core functionality in place and had my first (of many hopefully) test session with a user who has more than enough experience with the current version of Makro. And no it wasn't me, but it was my wife. The first session reaped great results: she found a few bugs, pointed out some issues with functionality and expressed her wishes of what Makro is missing at the moment.

It would be nice to get feedback from other users as well but unfortunately that is rather impossible. But for me this is enough though because I am developing this thing mainly for me and my wife. All the other users that want to use it are just an added bonus.

One of the limitations I have had to work with is the fact that I am stuck with the current database. I mean I could (and still might) just get the relevant info from there (like all the user data and added foods) and set up a new database for the new version but we'll see if I have the time and/or energy to do that. One of the things that I surely do have to fix is the one thing that I really messed up on last year. When I got the food data from Fineli for some reason I did not manage to find a version where they had used kilocalories instead of kilojoules. So what I ended up doing (which was really stupid) was that I used a for-loop to in frontend to convert the values to kilocalories and when users added new foods I had to convert the kilocalories to kilojoules before saving to database. But besides that there isn't that much I'd have to change.

To be clear the site is still going to be completely usable even without registering/logging in. Just like before. I wanted to keep it that way since not all want to register and especially if they know nohting about the site at all. You can still search for foods, add them to meals to plan up meals for the day. By not logging in you are only going to miss the possibility to add new foods, filter foods added by other people from the search and save the days you have planned. I think that's about all the things one is going to miss. Another security is that the user info is no longer saved into local storage at any point and the JWT does not include whole user info which was another huge mistake from my part.

I am going to keep the old one online for a while after I release this but I am hoping that people would start using the new one. It's going to have some new features, is more secure, looks more modern and in my totally subjective opinion it is going to be much better.

But yeah. That's about it. I'll most likely be posting about it more in the near future.

Comments: 0

Leave a comment

Docker and me

Sept. 4, 2018, 2:54 p.m.

All I hear about Docker is that how it simplifies everything and removes the works on my machine problem etc. My experiences so far has been that it hasn't really simplified anything for me. At least when it comes to getting apps to 'production'. I won't say that I don't like the idea of containerizing everything and that in itself is nothing too hard or complicated.

I said in my previous post that I had some problems setting up nginx reverse proxy.

Setting up the containerized nginx proxy with Lets Encrypt companion was easy. There were so many 'tutorials' which provided ready made commands for that.

But after that when I tried to access it just returned nginx home page. I spent way too much time deubbing that and in the end it turned out that I had accidentally created a container to which the proxy redirected all the requests made to Somehow I just didn't notice the damn container when using docker ps to list them.

After I managed to solve that the next problem was that I wasn't able to make any http requests from the app itself. Posting to http was blocked instantly by browser since the site was using HTTPS thanks to Lets Encrypt certificate. I won't go too much in to detail but eventually I just had to make a new address for the api and have that use HTTPS as well to get things working.

After I got all working I hit another problem. Using ng serve consumes a lot of RAM (I think it was around 500 mb) so my puny server was pretty much out RAM after one (really simple) app. Yeah sure, ng serve isn't meant to be used for production anyways but it was a huge disappointment still. And yes, this has nothing to do with Docker itself. That meant that I should build the application and serve it from somewhere. The question then was that where do I serve it? I ended up making a new Dockerfile for the frontend part of the app. All it did was install nginx and copy the stuff located in dist/ folder to nginx root.

In the end when I got my WoW Raid Tool online as well the RAM consumption hovered around ~500 mb which is significantly better.

I would have avoided all of these problems if I'd just deployed the apps directly to my server and ignored Docker completely. But I'm hoping that using Docker will pay itself back later on. At least now I know the process of deploying new app so it shouldn't really take that much time.

Comments: 0

Leave a comment

New projects

Aug. 31, 2018, 10:46 a.m.

It's been a while since my last post. I've been quite productive for the last couple of weeks. That is because the my work -section looks so damn disappointing that I wanted to do something about it.

First project that I did was a quick mock up for a catering site. I got the idea for that from my friend who has been planning to open up a catering business. It's a quite simple one but it looks quite nice in my opinion. After I was done with that I realized that I don't have anything to show of my current skill set (read Angular). It was time to fix that.

I started with backend (Node.js + Express.js) first. After I was done with the boilerplate code for user registration and login I decided to push that to github as a separate project which I can use later on if I need a backend with authentication services.

The project I was doing wasn't really meant to be big or anything special. Just something to show my current skills. In the end it was around 4000 lines of code which might be the largest project that I have done by myself. But I got it done quite fast though. And of course a part of that 4000 lines is Angular boilerplate etc but I'd argue that I've written at least 3000 lines for it still.

So what was the project then? Well almost a year ago a friend of mine asked for a tool for him to use and I'd say I'd do that. And I did. But I did it with Java and I used it as a school project, too. In the end it did not end up being that good and I just never got around of uploading it to the internet for him to use. So I decided to do that again and this time it ought to be a lot better. Far from perfect but still better.

The project is raid management tool for World of Warcraft. It's not online yet but I'm hoping to get it online during the weekend or next week at the latest. I've just had some problems with Docker and setting up nginx reverse proxy.

Comments: 0

Leave a comment

Oops I did it again

Aug. 10, 2018, 1:16 p.m.

Monday came and went but I did not write a single line of Go.

But as you can see I redid this site. Again.

The layout is pretty much done and I think and hope I found all the bugs and managed to fix them but there's still stuff to do. Stuff being all the boring parts like all the content. I got to write up some sort of bio or description of myself and description of the jobs I decided to list on this page. I think I'll add some other projects as well. It looks so empty at the moment and it might seem that I haven't done anything really.

Maybe I'll get back to writing Go sometime during next week. Although that might be a bit of a stretch since World of Warcraft: Battle for Azeroth is going live next week so that is probably going to consume all of my spare time.

Edit: Did the about page. Still got to add them projects but that is for another day.

Comments: 1

Leave a comment

Goodbye sun. Hello darkness my old friend

Aug. 3, 2018, 3:17 p.m.

I am back in business like all the cool kids would say. A lot has changed since the last post but none of the changes had anything to do with my hobby project. Hopefully now that my summer vacation is over and I'm starting to adjust back to my normal routines I'll be able to do some coding for myself, too.

It's been surprisingly hard to adjust to working again since my vacation was only 8 days. I think I just got into vacation mode and that's why it's been kind of a struggle to start working again. I certainly didn't hit the ground running as they say. It's more like I hit the ground face first and been just laying there ever since.

But it's not that bad as it might sound. I have managed to get work done and I'm slowly starting to come grips with the fact that my holiday is long gone and the next time I'm going to see the sun again is next summer. Unless the next summer is as bad as they usually are here and not like this one which has been suberb.

I think I'll just chill out this weekend and try to get some sleep. I haven't had a good night's sleep in like two weeks now and it is really starting to rear its ugly face.

Next Monday I'll start working on making authentication wtih Go and JSON web tokens to replace my Java based authentication service. Which is going to postpone the frontend development but so be it. I just don't have it in me to start working on it yet. I want to spoil myself with Golang. I have deserved it.

Comments: 1

Leave a comment

Busy as a bee

July 18, 2018, 11:53 a.m.

Unfortunately I haven't had any time to devote to my pet project lately. If I'm honest and remember correctly I haven't made any progress since my last blog post. This so called real life is keeping me real busy at the moment.

I think I could have squeezed an hour or two from other activities to do some coding but I've been kinda putting it off since I should start working on the frontend now. For some reason I just can't seem to push myself to get started on that. I'd rather do something more with Go.

That is rather odd, too. For the past year and a half frontend is the part that I have wanted to start working on and keep working on and backend has been kinda an afterthought. One reason could be that 90% of my time at my job I work on frontend (with Angular). Maybe I've just been enjoying Go a bit too much.

Either way I am not going to be able to any programming on my own for the next two weeks. And since I found myself from Azeroth again I might not have any time at all even after that. Like ever.

Just kidding. I hope.

But I really should do some kind of frontend for my project so I could write about it on my page with a picture since I have been planning to push it to GitHub. Although I could use the existing frontend for the picture since no one wouldn't know the difference.

Comments: 0

Leave a comment

Still Going on

July 10, 2018, 8:16 a.m.

It hasn't been too long since my last update but since then I have made tremendous progress. When I wrote my last blog post I had two of my planned 7 services ready(there's still lot to do with them but ready enough for now). Fast forward six days and I've made three more. Of course the last two to be made are going to be the hardest and ones that require more work than the other five combined. At least I think so but we'll see.

Some changes I've made:

I rewrote the first service I did to use GORM as well to keep the project cohesive. It made the service a little neater, too.

I made changes to my token validation on authentication service (the one made with Spring Boot). Before it just returned true or false if the token in question was valid or not but now if it is valid it will actually send the role of the user to the asking service as well. Then I had to modify the existing services to use the newly returned user role to check if the user actually has the rights to access the resource in question.

Now that the backend is in quite nice shape I can start learning React and Redux to start making the front end. I could take the easy way out and use the existing front end I made with Angular 6 (which is far from ready) and continue developing that but I really do want to learn to use React and Redux. Those seem to be in huge demand and React is the only one of the three most popular JavaScript frameworks that I don't really have any experience on. I do like Angular but I'm not the biggest fan of managing state in services. We shall see what it is like with Redux (if I ever manage to wrap my head around it).

PS. I am quite positive that I will ditch the Spring Boot authentication service entirely some day and use Go for that, too. Like I've said before I don't understand it so good at the moment and that can't be good, can it?

Comments: 0

Leave a comment

I have the power!

July 4, 2018, 10:18 a.m.

If you had been here just a few moments ago you would have seen and heard me yelling that just like He-Man.

Well not really but that is exactly what I felt. So why do I felt like that I had all the power in the world? Because I solved my problem I had which was saving my JSON to database. How? By using ORM or more specifically GORM. It wasn't really the solution I wanted to use at start but fuck it (pardon my french). It's my project and I can do what I want. Whatever

At this point I'm not sure if I should cry or laugh since using GORM made everything so simple. Only change I had to make to my struct was changing the type of the property in question to postgres.Jsonb. My getAllItems function went from 20 lines to 2 lines and createItem function went from 25 to 9. The create function does have some unneeded extra like creating UUID and logging if errors (unneeded for GORM that is) so it could be done with just one line:


I haven't done delete and update functions yet but I expect them to be as easy as those two, too. I'm just wondering if or when does this decision to use (G)ORM come back and bite me in the ass. It does add that extra layer of abstraction I wanted to avoid but at least I can move forward with the project now.

Edit: Updating records was trickier than I thought but nothing too difficult though. For updating GORM wanted to have the primary key (at least I didn't find a way around it) which I do not send to frontend at all. So first I had to search for the record I want to update just to get the primary key and then assign it to the object created from JSON and then do the update.

Comments: 0

Leave a comment

Tukki used struggle!

June 28, 2018, 5:30 a.m.

I just always seem to be struggling when it comes to making a backend with anything else than Node. In the last post I said that it would be easy to do the other services with Go since I already made one and they're basically the same. Well they are not and I was wrong.

In theory they are very much the same. Just some CRUD functionality around different structs. So why is it so hard? That's because of my good old friend JSON. I wrote already about the difficulties handling JSON with Java and now I am struggling with same kind of problems wtith Go and JSON.

The problems arose when I tried to receive a deeply nested JSON and save that to DB. What is even more irritating is that I do not need to map it to anything but just save it to database. I do map outermost JSON to a struct but the nested part doesn't need to be mapped to anything.

{ "property 1": "key1", "proeprty2": "key2", "jsonArray1": [ { "object1": "key1", "jsonArray2": [ { "object2": "key2" } ]  }]

The JSON in question looks a bit like that but with more properties and more stuff inside the arrays.

The first approach I tried is that I made a struct where I had one property with type of json.RawMessage with the hopes that it would work since it is just saved to database and nothing else. Obviously that didn't work since I am writing this post. PostgreSQL just gave me error about a malformed array and I couldn't get around it. After that I have tried having structs for those JSON arrays and after that I tried nested structs. I can't remember the errors I had (they're in my error log though!) but I just couldn't get it to work which is really frustrating. On the surface it looks like a rather simple problem to solve but yet I just don't seem to be able to crack it. At this point I would just really love to get my services up and running and start working on the frontend with React.

Comments: 0

Leave a comment

Time to Go?

June 20, 2018, 8:18 a.m.

I want my new project to follow microservice architecture (whatever that means) like I said in my last blog post. There has been some slight changes in my project since that. I still have that first service (authentication) made with Spring Boot up and running but most likely that is going to be the one and only service made with Spring Boot. I still don't like all the abstraction in the authentication process. It just makes me confused and I haven't had the time to try and undestand what is happening and why. But that is not the main reason why it is probably the only Java service. Even barebone Spring Boot apps tend to eat a lot of memory (anything between 200mb to 1gb). That is a big no-go because of my very limited resources (just one Digital Ocean droplet). Enter Go.

But a lot has happened in the last couple of weeks, though. I have made my very first CRUD app with Go(lang) and I am pretty excited about it. It didn't actually take more than a couple of days since it is very basic CRUD app. But it is exactly what it needs to be. Only "special" thing about it is that it authenticates against the Java service with JWT via HTTP calls. And the best part is that since I got that up and running it's a lot easier to make the other three or four services with Go since they are basically the same. CRUD functionality with authentication. Why? Keep It Simple Stupid.

I'm just starting to get into Go and I really like it so far and I'm hoping that it gets even better when I understand it a bit more. So far so good. One of the biggest things that I haven't found out is that what is the project structure supposed to be like. At the moment it's not that big of a deal since my services are going to be very simple, though.

Last night I ran into a a Go framework called Buffalo. It seemed a lot like Django for Python (which I liked) and made me pause for a moment to decide whether to use it or not. Ultimately I decided not to. It would just add great deal of abstraction and unneeded stuff for my simple services even though it might make the development process a lot faster. But it is intriguing and I might try it out when I have time for that (like redo this site [again]). The simplicity of my services is also the reason why I opted out of using ORM, too. I'm positive that it would make development faster and my life possibly easier but again it would add layer of abstraction that I do not need. Great thing about this microservice architecture (or just service oriented?) is that I can decide to use Buffalo or ORM or similar to a service where it is needed/useful.

While we're talking about Go I have played Pokemon Go almost for two years now.  Awesome, isn't it?

Comments: 1

Leave a comment

Programming is hard and then you die

June 6, 2018, 7:04 a.m.

I seem to be constantly struggling on my path to be a decent programmer. Lately I have been trying to set up authentication for multiple type of users with Spring Security. I feel that I am so close to get it to work which makes it even more frustrating.

This was so easy with Node. All I had to do was make separate endpoints to login, query different tables in database and that was the end of it. But now with the combination of Spring Boot / Spring Security / Hibernate it seems to be a lot harder. All that extra layers of abstraction makes it that much harder. I did manage to get registration to work for both types of users and login for one. I am hoping to solve this problem by the end of this week though. This kinda feels like the same problem as I had with Django which ultimately made me to switch back to Node.

So what the hell am I doing with Spring Boot? That is a valid question. I'm trying to get this to work with that instead of Node because as soon as the projects grows over 1000 lines it just feels like a big mess no matter how I try to organize my code. There is another reason as well and not just my messy architecture. For some reason it just feels better to use Java. I enjoy coding a lot more when I fire up IntelliJ IDEA CE and start typing that verbose Java code.

But my project might use other languages than Java as well if I manage to get everything to work like I want to since I want to do microservices instead of a monolithic application.

I'm actually in the middle of changing my programming environment, too. I have started migrating to Ubuntu 18.04 from my Windows machine but it's not that big of a deal since it's just a virtual machine I'm going to use for development so still going to use my beloved Windows PC. The reason for this change is that suddenly npm stopped working and nothing seems to fix that. I did plan to make the switch anyways in the near future just to keep my main PC clean of all of those programming related dependencys like code editors, databases and languages. Sure I could have (and probably should have) used Docker containers. But I got too much on my plate w/o Docker already. 


Update: three days later (read three hours of coding) I managed to solve the puzzle. What I actually needed to do was create two custom authentication providers (actually I do have to create a third one for admin users). I had managed to figure that our earlier but the implementation was the problem. It does feel simple enough now that I have made it but the process was a pain in the ass given my stupidity and lack of experience.

Comments: 0

Leave a comment

My friend JavaScript Object Notation

May 15, 2018, 8:40 a.m.

One of the best (and probably worst) things of working with Node is that it's just JavaScript. Why is that a good thing given the reputation of JS? For me it has to be the native support of JSON. It makes sending and receiving data from server to client such a breeze.

It's not that it is something like borderline impossible to work with JSON with other languages but I find it a lot more difficult. Especially with statically typed languages such as Java. It's not such a big thing when the JSON in question is simple but the more complex it is the harder it gets. Or I am doing something really wrong (which wouldn't be a surprise given my less-than-average [programming] skills).

Not so long ago I ended up making a endpoint for receiving data from client at work. The JSON isn't even that complex but I ended up having a lot of problems with it anyways. Actually by the time I am writing this it is not ready so eveyrthing might change later on. But anyways. The JSON in question looks something like this:


"key": [ {"name": "example", "value": "123"}, {"name": "example2", "value": "1233"} ],

"key2": [ {"name": "example3", "value": "12"}, {"name": "example4", "value": "1"} ]


The arrays were longer of course but you get the gist. So that ended up to being this in Java:

ArrayList<HashMap<String, ArrayList<CustomJavaClass>>>

Not that pretty. And on top of that I have some serious problems deciding the types what to use but that is most likely because of my limited knowledge of Java data types. I hope that this gets easier when I get more experience with Java.

EDIT: Scratch that. I decided to make a wrapper class. The class has two properties:
HashMap<String, String> and ArrayList<CustomJavaClass>

Made things a lot easier.

PS. My project is getting along rather nicely. I will write about it more soon. Maybe.

Comments: 0

Leave a comment

Such shiny. Much interesting.

May 4, 2018, 7:50 a.m.

What I really dislike about myself is that I seem to be unable to focus properly on one thing at a time. I get excited about something, start doing that and five minutes later I see some other shiny thingy and I just have to start chasing that and so on. A great example of this lovely behavior is my inability to pick a (programming) language and stick with it.

I have talked about JavaScript, Java, Python and their frameworks in this blog. How I plan to learn them and use them in my projects. I've done that only with JavaScript so far to be honest. Yeah, I have done some minor things with both Java and Python but nothing really worth mentioning.

Now with this new project I have managed to switch technologies twice already and I've barely even started it. First I said that I'm going to use Django, Django Rest Framework, React and Redux. Then I switched from React + Redux to Angular 6. And now? I ditched Django and DRF for Node and Express. So why on earth did I actually do that given that I was so enthusiastic about it just like a week ago?

I made the switch because I was stupid enough not to get it work like I wanted to. I hit a wall when I tried to make a couple of registration endpoints paired with two different user models. I just couldn't get it to work and I didn't manage to find help from the almighty internet. I am sure that is a trivial task for people with normal IQ but for me it seemed impossible. After I spent somewhere between 5-10 hours hacking that (and smashing my head against a wall) I decided to switch tech.

It's not like I just quit because I wasn't able to solve the problem I had but more like because I have very limited time to use on my projects and I felt that I was going nowhere. I need to be productive during the little time I have to spare. So Node was a natural choice because I've used it before and I am productive with it.

So now my new project is going to be made with pretty much the same tech as my biggest project so far (which seems so small now btw) but instead of MongoDB I am using PostgreSQL and Vue is changed to Angular. But I guess it's better to be as fluent as possible with one language (even though that language is JavaScript) than mediocre in five.

But I would be lying if I said that my mind is firmly set on Node. Because I do see one shiny thingy in the horizon that just seems to pull me towards itself. Everyone says great things about it. Personally I think it would be a great way to futureproof oneself. They say that it has clean syntax and that is simple. They also say that it is easy to learn. We'll see about that last part. Although I guess everything is easy when you already know how to code properly and aint a retard like me.

Yeah you guessed right. I am talking about Go(lang). That I really do want to learn. But at the moment I really don't have any time to "waste" on learning it and figuring out how everything works because I want to get a proper project done so that I'd have something to show and tell when I'm asked what have I done.

Comments: 0

Leave a comment

Open the Windows

April 24, 2018, 8:21 a.m.

Since I started doing any programming at all I never thought about using Windows. The choice was always between either Linux or macOS. When I took my first steps with Python I used Linux.

Fast forward a few years and when I started programming again (this time with JavaScript) I used macOS. I had (still have) a Macbook Pro for school and it was only natural to use the same computer to practice developing websites. But about a month ago I started practicing Java using Eclipse as the IDE. It had always felt a bit sluggish on my MBP. Then it occurred me that there's nothing preventing me to use my main computer for it. So that is what I did.

I fired up my trustworthy Windows 10 PC who had been neglected lately and installed Eclipse and JDK. I was flabbergasted. The difference between my PC and MBP was like night and day. Eclipse was not sluggish at all and there wasn't really any drawbacks using Windows. Actually everything was much better and as a added benefit I could use my lovely mechanical keyboard.

Yes, yes, I know. There was nothing stopping me using it on my Macbook as well except a few missing keys. I just couldn't be bothered unplugging it from PC and plugging it to MBP.

Given the positive experience with Eclipse & Java I decided to give a shot to Python (Django) development on a PC. Guess what? No problems at all. Everything worked like it should. Sure there are minor differences setting up stuff but nothing special. So I did my blog.

Naturally I started developing my new top secret project on Windows as well. I mean why shouldn't I have? I hadn't experienced any setbacks at all. For the new project I am using Django and Django Rest Framework for the backend, PostgreSQL as the database and frontend is going to be made with Angular 6 with Bulma (just because I just couldn't get Bootstrap to work properly [it did work nicely with Angular 5]).

Pretty much all I have missed from Linux/Unix like environments is the terminal. Command line isn't really for me. It feels so different (no surprises there since it is not the same) but luckily Git Bash is a fine replacement for Linux terminal. One negative thing about all of this is that I am tied to my PC but that has nothing to do with Windows. And I really am not that tied to it since I can use GitHub or similar to share the code between computers.

So in conclusion I am most likely going to continue doing most of my development on my PC from now on.

PS. All the databases I've used so far on Windows (MongoDB, MySQL and PostgreSQL) I have experienced zero problems which I did not expect. And as a added bonus (or it could be a drawback depending how you look at things) they all have had a nice GUI admin tool.

Comments: 0

Leave a comment

I'm so excited

April 20, 2018, 9:41 a.m.

I have struggled a lot to come up with a new interesting project that I could do and improve my skills while doing that. It has actually been always a problem for me. It's really hard to figure out what to do that would be both interesting to do and useful (for me or others). And on top of that it should be a good project for learning stuff and ideally at least a medium sized project.

I have had a few ideas but usually they are not that interesting or useful or they are just too small. I mean there is nothing wrong with small projects but I've been looking for at least a medium size project. But finally I can stop racking my brain and googling for projects to do. It took me a while but now I have a great idea that could potentially be (if done right) really useful for quite a lot of people. But more importantly it is a really interesting idea and I'd say it's at least medium.

If you still remember 'Makro' this new one is is like three times of that at the bare minimum. For the new project I am going to use Django and Django Rest Framework for the backend and database engine of choice is PostgreSQL. For the front end I was planning to use React + Redux. All of these technologies are chosed because I have almost no experience with them and those are things that I want to learn.

Yes, yes, I still want to learn Spring Boot but I decided to focus on Django first since it seems a lot simpler to grasp and because I'm not that smart. I've started modeling the database already (which is really fun) using a free online tool called DbDesigner. I also started making task list using Trello to keep track of things that I need to do and what I have done already.

Unfortunately I probably don't have any time during the weekend to make any progress with this because I am planning to finish couple of course for school. After those two I'd have only two course and thesis left to do. After those are done I ought to have more time to do this. But for now I'll just have to settle for an hour or so per day.

Comments: 0

Leave a comment

Django (unchained)

April 16, 2018, 10:16 a.m.

I spent last weekend doing some stuff for school and there was an assignment to make a personal site. I already had one but I had been planning to make a new one for a while so it was time to get my hands dirty. I think I said that I'll make a blog for myself using Spring boot but yet I chose not to. Instead I chose to use Python (3) and Django and I got to say it was such a delight. I have never experienced such rapid development.

Funny thing is that I did not write a single line of JavaScript. I think the end result looks a lot better than my old site and I am really glad that I chose Django. I am definitely going to use that for my next project as well to learn it better.

PS. 100 days of code challenge is over but I am still going to continue code every day.

Comments: 1

Leave a comment

A Cup of Java

April 8, 2018, 10:02 a.m.

I have an ongoing process to update my pages but it is a rather slow one. Usually during normal weeks I manage to squeeze around 5-10 hours to do some coding for my own projects. And that is the best case scenario.

I have these great visions of how I want my blog and page to look like but the image of that is slowly fading out of my mind since the project progresses oh so slowly. And doing that with Spring Boot and Angular is not speeding it. Quite the contrary since I am not really familiar with either of those (getting there though). So why am I using those for it?

Lately I've grown to really like Java for which I am quite surprised. I did not like it at all (and hated Eclipse) when I had to stuff with them for school. Eclipse felt so clunky and outdated and typing Java was so slow compared to typing JavaScript with Atom or VS Code. But for some odd reason I now like to use Eclipse and code with Java.

I suppose it is a good thing since Java is so widely used and it's fast language (like that matters in my projects) and it can be used virtually anywhere (again not something that is that useful for my projects).

But why a blog then? You already have one? Well, yes. Kinda. This one sucks to be honest. There isn't really any kind of formatting and no possibility to add images or whatsoever. So pretty useless. And my page looks outdated as well and I thought that this would be a nice and easy little project to start with. Unfortunately for me it's not quite as simple as thought and because of my godlike ability to focus on one thing at a time I have actually started another project as well. Split the little time I have between two projects and you get nowhere.

Another thing that is really consuming my free time at the moment is school. I decided that I want to graduate by the end of upcoming summer (not by the end of this year like I originally planned) so that means that I have quite a lot of shit to do for school. But it should be doable. And I am going to do that no matter what. Why it matters to me so much? Just because I want to be able to say that I got my bachelors degree in year and a half. Finally I have something to boast about. Just kidding. I just want to be done with school as fast as possible so I can focus on other things and finally have some free time again. I want to play games and I want to have more time for coding outside of work.

Comments: 0

Leave a comment

Type type type

March 18, 2018, 9:02 a.m.

Not too long ago I switched jobs (again) but hopefully for the last time (at least for a few years). Now I finally get to do for a living what I love to do which is code. Officially my title now is Software Engineer but I don't feel worthy of it. Not yet at least.

I applied for a full stack JavaScript position but the current gig I'm involved with is not full stack JS. I am mostly responsible for front end with my colleague and we're using Angular 4 for that. But the backend is going to be Java with Spring Boot and I think I am expected to get my hands dirty with that as well. Both (Angular & Spring Boot) are quite new to me and I've been trying to learn them as much as possible.

Fortunately Angular does not feel that difficult since I have used Vue.js quite a lot in my own projects. But what has been and still is quite hard to grasp is the code base. It differs so much from my own projects (shouldn't be a surprise to anyone) but really did not expect to be that different. So I have been struggling lately. As you might know Angular is usually used with Typescript and I really, really like that. I am planning to use that from now on even in my own projects (started to do that already). And I think I am trying to switch to Java ( & Spring MVC / Boot), too.

Comments: 0

Leave a comment

A glimpse into the future

Feb. 16, 2018, 9:02 a.m.

For a while I got sucked into the flashy but messy thing called front end development. Even though I had said before that it ain't for me. But yet I found myself doing web dev with focus on front end and I did like it. Making things with Vue felt natural and fun but I had (and still have) problems with the design aspect of it. My websites tend to look more or less the same. But all good things come to an end.

Since my latest project I've really fallen in love with backend development. How did this happen you might ask (or not - what do I know). The project I am working on at the moment is not just mine. I'm doing it with a friend from school and he wanted to do the front end which meant that I would have to take care of the backend.

I was planning to use Golang for it but since the site is not for me I decided to stick with what I know already (to some extent); Node + Express. I have used Golang only for a web scraper so far and that is not even ready yet. For database I had to go with a relational database so that ruled out my beloved MongoDB. It is a first time for me to use SQL database with Node so that was kinda exciting.

So I've been working on it for the past week or two and I have enjoyed working on it so much. Especially with all the things related to database. For some reason I really, really like using databases. Inserting stuff, modifying, planning the relations and adding constraints. I'm getting a bit too excited just thinking about it.

It is not like I don't like front end development anymore but I seem to enjoy more working on the backend. But still I definitely could see myself working as a front end dev given the opportunity. After this project I am going to focus a lot more on the backend with my own projects.

And for the next project I'll most likely use some other language than Node. It might be Golang but it very well might not.

P.S. 100 days of code challenge is still going strong. You can always check my GitHub account if you don't believe me. My username there is maxaboxi.

Comments: 0

Leave a comment

A blast from the past

Jan. 19, 2018, 9:01 a.m.

Not so long a go I got an email which was a review of how I spent my time during 2017.

Sometime at the beginning of June last year I installed RescueTime to my laptop which I mainly use for development and school stuff. RescueTime logs the time you spent on different things in the background and then reports it to you weekly.

So from June to December I spent 521 hours on my laptop and from those 521 hours 462 was count as productive hours. 27 hours was count as distracting.

From those productive hours 317 was count towards software development. I am quite happy about it. 58 hours and 20 minutes was spent for category labeled as 'Reference' which I think stands for websites like StackOverflow etc. 

Whole report:

Software Development 317h

Reference 58h 20m

Communication & Scheduling 33h 41m

Design & Composition 29h 9m

Uncategorized 23h 58m

General Utilities 20h 32m

Entertainment 16h 38m

Business 11h 18m

News 5h 48m

Social Networking 3h 8m

Shopping 1h 29m

That entertainment took me by surprise but I think that comes from watching YouTube tutorials.

PS. My 100 days of code -challenge has started really great. I have a new project that I am working on and my GitHub commit streak just keeps getting longer and longer.

Comments: 0

Leave a comment

New Year and 100 days of code challenge

Jan. 5, 2018, 9:01 a.m.

My New Year's resolution was to do the 100 days of code challenge.

It's pretty simple: spend an hour coding every day for the next 100 days and tweet your progress every day with #100DaysOfCode hashtag. I am not going to tweet since I don't really use Twitter but I will (and have coded) for an hour every day. I didn't start the first of January though. Decided to do some Netflix and chill with girlfriend instead.

Since I started the second of January the last day of this challenge will be.. umm.. well 100 days from that. And because I am not going to bother with Twitter I will be updating my progress here every now and then. So far I have used my hour per day for trying to make Makro more responsive so it would be usable with mobile devices as well. I have made good progress already but there is still quite lot to do. But I have at least 96 days left to accomplish my goal.

Comments: 0

Leave a comment


Dec. 28, 2017, 9 a.m.

My 2017 summed up (from end to beginning):

The mobile app ended up being my last project for this year. Towards the end of this year I had less and less time to spent on coding and more and more of excuses for not having time to sit in front of my laptop and just code something. I finally eliminated one excuse (not having ideas for projects) and so my new years promise is to code even more next year. And even though I did not manage to do programming as much as I originally planned I am happy about how this year turned out be - it was far from perfect but not a disaster either.

I was planning to use React Native to make an app for Makro. But now I have decided against it. At least for now. Why is that though? I had a course in school where we were required to make a mobile application and I tried to use React native. I ended up making a really simple app with locates the user, saves the address to database and gives the user possibility to do a Wikipedia search based on the city you are in and return 10 articles for the user to read. I did not enjoy the process of making the app. Granted, it was my first time dealing with React Native but for me it did not seem to have any logic in it. Sometimes it worked and sometimes it did not. The fault was probably somewhere in my code but I was not able to find it. I think I'll just try to make as responsive web page as I possibly can for Makro as soon as I have time for it.

I made a switch from Atom to VSCode for no reason at all. But I started immediately like it a lot more than Atom.

At the end of autumn I finally got around to use Java for a real project. Friend of mine had a need and idea for a (web) app and asked me to do it. I decided to use Java since I needed a project for my school course. I almost started liking Java while coding. I'll most likely try to use it in my next project as well. My biggest gripe with it is being stuck with Eclipse (or Netbeans) and I really do not like it. It's sluggish to use and doesn't seem to be able to intend code at all. It probably can but I'm just too stupid to figure out how. To be honest I haven't really put time or effort to learn it.

During autumn I learned the basics of Java and relational databases by doing small projects for school.

By the end of summer I had started working on Makro to get a better grasp of MEVN-stack and to get free calorie counter for myself.

I spent the summer learning Vue.js, Node.js, Express.js and MongoDB by making full stack web apps.

First I made a portfolio, searchable list of my movie ratings from IMDb and a self playing game with Vue.js. Then I remade them as fully fledged web apps with a 'proper' backend.

From February to May I was learning HTML, CSS and JavaScript by making basic websites starting with CV, kind of portfolio, website for my band, a better portfolio (with the help of jQuery).

In January I started school and a couple of weeks later got the spark to start learning programming.

Comments: 0

Leave a comment

Finished product

Oct. 27, 2017, 10 a.m.

Back when I started coding Makro I couldn't wait till I'd be finished and could upload it to the internet for people to test and use. Now it's been available for couple of months and it has 101 registered users (by the time I'm writing this) but it's still far from finished. It is perfectly usable (probably few bugs here and there though) but it still quite isn't what I dreamed and planned it to be.

First and foremost it is not really usable with phone. Actually I wasn't really planning to make it usable with phones but I did plan to do an app for it with React Native. And now couple of months later I've yet to even start that project. It's not like I don't want to but I lack the time to get on with it. I got a lot of school projects going on at the moment and I'm going to switch jobs in couple of weeks which means that I have had to learn basics of some new stuff (Ansible & Jenkins) and of course do my job. Hopefully I'll have time to start working on the Makro app during the beginning of next year but we'll see.

Even after this year I'll have around half of my school courses left. I'd like to improve this blog as well. The things that I have in mind are minor stuff and shouldn't be hard to implement (knock knock) like listing of posts to the side and maybe some kind of bio & info section, too. I've been thinking of moving this to a separate domain as well but don't know if it is worth it. It does cost money and it is not like I have a lot of readers anyways. But as you can see even this is far from finished.

So my question is: is there ever a finished product in software development? Or is it always a work in progress?

Comments: 0

Leave a comment

Never hard code anything

Oct. 11, 2017, 9:59 a.m.

I am quite sure that this is quite obvious to everyone except me.

I mean I did know that before but yet I just had to learn it the hard way. When I made Makro I made a decision to hard code six different meals and names for them. I did not think that it's that big of a deal back then. I remember thinking "I'll just change them when I get this working" and "It's easy to fix".

As it turns out it is quite a big deal and not that easy to fix. In order to fix my awesome decision I have had to recode stuff way more than I ever imagined. And the funny thing is that I'll have to do something to fix stuff saved in database as well (I will probably fix it on the client side when needed - lets see if this decision is going to bite me in the ass later).

On the front end I have 10 components and I have had to change/fix/redo 5 of them already and I'm not even done yet. Of those 5 components 4 are major parts of the website. At the moment it looks like that this fixing is going to take at least better part of this week before everything is ready. And after that there is still testing left before I can even dream of uploading it for my users to use. Silver lining here is though that hopefully I will never make that mistake again.

Comments: 0

Leave a comment

Me, myself and my lack of knowledge

Sept. 26, 2017, 9:59 a.m.

When I was like Jon Snow and knew absolutely nothing (especially from databases) I thought that all databases are treated equal. Just pick one and use that. When I knew a tad more than nothing I thought that why would anyone ever need a relational database because MongoDB can do everything just fine. Even when I started a course on relational databases in school I still had the same thought.

During that course I started to realize why one would need a relational database but at the same time I was still sure that I would not need one. Like ever. And again I was wrong. A friend was wondering why I didn't have the possibility for people to comment on my blog posts. I didn't even think that would be necessary. I mean it's quite random that anyone would ever stumble on my blog and even if someone did why would he/she comment on my ramblings?

But since I had not yet made it possible for myself to even edit my posts (don't ask why..) I decided to enable commenting as well. Everything went quite smoothly at first. Did the routing and front end component for comments. Then I stopped to think that how am I supposed to let MongoDB know that a blog post and comments are related to each other. It is not a relational database and here I finally realized how ignorant I had been. Now I actually understand why relational databases are needed in the real world.

Since I was not that confident (yet) with my database building skills I decided to stick with MongoDB for better or worse. I made a collection for comments and when a user posts a comment it has a property of blogpostID which is used for getting the right comments for each post. In the end it was not that big of a problem. The bigger problem was when I wanted to implement comment counter for each post. I couldn't figure out a way to update two different collections (it's probably quite simple in the end) at the same time.

Eventually I found a good documentation by MongoDB for Two Phase Commits but at this point I had decided to give up. But I gave up only because I planned to build a relational database for my blog as a school project which is required later on. I thought that this could be a nice one because I have real world use for it and it's always more fun to build things that one actually has use for.

Comments: 0

Leave a comment

Short history of part 2

Sept. 11, 2017, 9:58 a.m.

After deploying Videoknight to Heroku I was full of confidence. I had just completed my first full stack web app. I was so ready to start working on Makro. Little did I know about the problems which were patiently waiting for me to find them.

This time I started with the back end. At first it ended up looking quite the same as with Videoknight. When I was done with that I tackled the front end. I had simple layout (designed by my GF) to aim for and based on that I made the decision of the needed components etc.

First up was search. The actual search was really simple at first; just array.filter based on user input. No sorting of the results whatsoever. This is where I encountered the first big problem: it didn't work. The search component was made to get food data from database when mounted (no idea why I decided to get it every time it mounts instead just when created - I did change it later on) and save it to variable. But for some reason the filter method did not return any results and the error message was 'TypeError: undefined is not an object (evaluating 'this.searchTerm')'. I spent quite some time trying to debug this but eventually had to ask help from StackOverflow. The reason was that for some reason the data I had downloaded from Fineli had some foods that were missing the name key - value -pair completely.

After the search component was working I made component for the foods the user had added. After giving it some thought I decided to make a separate component for different meal to avoid duplicate code. So I made component AddedFoods which had a child component foodTable where the foods user had selected were passed as props. AddedFoods handles the total count for macros and calories while foodTable handles the totals for the meal. I think with these two (at least at this point) I didn't have any significant problems. Maybe some minor hiccups calculating the totals when given the user the possibility to change the amount of the food added afterwards.

If my memory servers me right at this point I was ready to make login, register and navigation bar components. Nothing special with them. After I got the registration and login working I started working on the possibility to add (missing) foods to database if the user was logged in, the ability to edit their own information (height, weight etc) to get their base daily calorie expenditure. Then the last feature which was the possibility to save the day the user had planned to database. I'm quite sure that there wasn't any big problems with these and Makro was almost ready to be deployed.

Or so I thought. I had forgot to work out a solution for the selected foods to be saved somewhere so that they wont disappear if the users goes to check their dashboard or anything. For this I decided to use local storage. I had to code some parts again so that the foods saved in local storage would be loaded when navigating back to dashboard and so on. I almost forgot to guard routes and while doing that I realized that if I want to have my app have any traction, it has to be over https instead of http.

After I was done guarding the routes I started working on the https part. That didn't require any changes to the code but just some stuff made on server. Luckily for me there were step-by-step guides for setting up nginx and LetsEncrypt certificate for my app. And I was done. I deployed Makro to my DigitalOcean droplet and posted about it to couple of forums just to let people know and to see if anyone would be interested. By the time I'm writing this Makro has 36 registered users which is huge for me. After I got Makro online and told people about it I realized that most of the heavy lifting is done on the client side. That happened actually by accident since I'm much more comfortable working on the front end but it is a good thing. The droplet I use to server Makro is not that powerful so that is not stressed as much as it could have been.

Later on I have added couple more features (replaced the array filter based search with vue-fuse) and will continue on working Makro as much as needed. I had to learn a lot more stuff during this project than I anticipated based on my experience with Videoknight. I got better with backend and MongoDB and of course with Vue.js. But I still have a lot to learn.

Comments: 0

Leave a comment

Short history of part 1

Sept. 2, 2017, 9:57 a.m.

My latest project was a calorie counter / meal planner. Technically this was the latest but since I didn't have to do much for this I don't count it as a full project. For the calorie counter (later referred as Makro) I used MongoDB as the database, Node + Express as the server and Vue for front end. So far I've been happy with the decision.

When I started planning for Makro I thought about using PostgreSQL as the database (this was before I made my first full stack app, Videoknight). But I ended up using MongoDB since the data that I was importing to the database was in JSON format already and Mongo ate that nicely so I went with it. Setting up the database was simple enough. In the beginning I had only two collections; one for the user data and second one for the foods. Later on I've added two more: one for when the users want to save their planned their day and one for feedbacks.

When it comes to back end I really had no idea which language and technology to choose. I tried out both PHP and Python but in the end I decided to go with JavaScript so Node + Express. Haven't had any regrets so far. I enjoy using JavaScript (probably because that's the language I have used the most) and Node seems a solid choice for server.

I had some trouble choosing a JavaScript framework for front end as well. First I looked at React and it seemed good enough and I was most likely going to choose it but I wanted to try out Angular, too. Angular felt really heavy and clunky and seemed to have a quite steep learning curve so I ditched that for this project. I just wanted to get it done sooner rather than later. But before I started with React I ran into Vue.js. It seemed cool, light and easy to learn so I gave it a shot as well. And it really clicked. I liked it immediately. This was the framework I was gonna use. But before I started working on Makro I had to try these technologies first. I wanted everything to go smoothly with Makro. It was going to be my pet project.

First I wanted to try out Vue and made my IMDb voting history website with it and I made a RESTful API for it to use with Node + Express. It was nothing too complicated and seemed like a good way to get started with this stack. After I was done with that I wanted to make portfolio v2 with just Vue to get a little more experience with it before starting Makro. And when that was ready it was time to start. But not with Makro though. I had gotten an idea for a self-playing game which came to known as Videoknight.

First I made the front end which was rather simple. There wasn't that many things to do. I found a package for getting YouTube videos which made it really easy to listen to when the video that was playing ends and so on. Then it was time to get working on backend and database. I wanted this game to have a possibility to save progress so you could continue playing and leveling up anytime you wanted. The only way to do that properly was to register user and save their data to database. I think I had some minor problems while doing this project but I can't recall what they were. The biggest time sink with Videoknight was finding the channels where it pulls the videos for the game. I had to look for channels that had at least 50 videos since I wanted to use YouTube API in a way that it gets the 50 most recent videos uploaded to that channel. I wanted to avoid errors of channel not having 50 videos.

I set up channel IDs to arrays of 12 (because entering more to array made my editor bug and not highlightin syntax) and there is around 15 of them. So quite a lot of videos. I learned a lot during that project about saving data to database, setting up user registration, login and stuff like that. Now I was ready to tackle the biggest challenge so far. Making my own calorie counter. But more on that later on.

Comments: 0

Leave a comment

New portfolio is up and running

Sept. 1, 2017, 9:57 a.m.

Today I made a new portfolio site for myself. This is actually third version now. There isn't that many changes compared to the previous one but I finally decided to implement blogging possibility to it. This blog will most likely focus a lot on my programming projects and stuff related to those. So probably a great deal of the content will be about coding. But I wouldn't be surprised if I'd decide to write blog posts of other aspects of my life.

I had some minor issues setting this up on DigitalOcean server. It was because I am using only one droplet (at the moment) to host both this and That meant that I had to setup nginx for this one as well and that had some tiny complications. Fortunately I managed to resolve them all and this is up and running now (as you can see). I'm not quite sure about the styling of this site yet. It is a bit bland so maybe I'll manage to do something to that. Or not. Web design has never been my strong suit and I seriously doubt that it never will be. I have never been good with colors or with anything even related to arts. I think this is enough for the first post. It's getting late (10 pm) and I got to get up early to do some coding.

Comments: 0

Leave a comment