Categories
Backend

NopCommerce plugin reference loop result in duplicate assembly

Categories
Backend Database

Django dump all data into JSON

I know you could do it by dumping the database directly, but this could come in handy when you’re trying to migrate from one database to another. AFAIK, copying data from one kind of DB to another kind(think Pgsql to MySql) is a nightmare… Luckily, Django provides a utility to make this super easy.

Categories
Web

Angular FormBuilder group unexpectedly change array to value

Problem Component editor receives an object and create reactive form base on the object passed in. Something like this(most fields are omitted): this.form = new FormBuilder().group({ id: this.postObj.id, tags: this.postObj.tags, }); But you will realise the tags field does not really behave like what you wanted(well, at least not what I was expecting) Pass in: […]

Categories
Tools

Jenkins Docker in Docker

Yesterday I was trying to deploy a Jenkins on a Linux machine. From my past experience, the official Jenkins Docker image works very well, I can build all of my projects without doing any messy configuration. However, the latest Jenkins Docker image seems to be a simplified version, as in most of the plugins and […]

Categories
Tools

CircleCI and Coveralls integration

Spent 2 hours to figure out how to automate Coveralls checking in CircleCI, the online articles are really outdated and not working… Solution You will need this library github.com/mattn/goveralls The idea is to run test coverage and save it into a file, then use the above lib to post it to Coveralls. Don’t forget to […]

Categories
Web

ngx-admin infinite interceptor call

Problem After setting up Auth in ngx-admin, the http call gets stuck in interceptor. You may see error in console like Max call stack reached… Pattern First step to solve a problem is finding when or what the problem is triggered. The problem seems to happen daily and the workaround is to clear the token […]

Categories
random

Symbolic link fails on MacOS

Problem when you try to symbolic something using ln -s xx xx, you may get Operation not permitted error. Even sudo can’t solve the problem. Solution You need to enable full disk access to your terminal. Go Setting -> Security & Privacy -> Full Disk Access and add your terminal app in the list. (I’m […]

Categories
Linux Tools

Jenkins user gets permission denied for using docker or docker-compose

Error message When you run docker-compose up -d in your pipeline script, the following error is thrown. The APPDATA variable is not set. Defaulting to a blank string. Couldn’t connect to Docker daemon at http+docker://localhost – is it running? If it’s at a non-standard location, specify the URL with the DOCKER_HOST environment variable. Solution Your […]

Categories
RTOS

FreeRTOS xSemaphoreTake always fail

Here I am using binary a semaphore to protect(lock) a shared resource. Only one of Task 1 and Task 2 can only get the lock at any given time. Problem xSemaphoreTake() always return pdFALSE which means the semaphore is not available. I’ve checked all my code, no one take the semaphore… This really drives me […]

Categories
Backend

Django REST always return hyperlink with http proto even if the request is made via https

We always host Django app behind a proxy server(apache or nginx) in production, the connection from your client and the proxy server may be(better be) https. However, between the proxy server and Django app(gunicorn or whatever you’re using) is usually http. So Django thinks that the client is using http, and returns all hyperlink including […]