Javascript, JS

[3 Steps] Customize theme for Ant Design with create-react-app 2019

BACKGROUND In order to alter the theme of Ant Design, there are multiple target files that we have to change. The most important file will be the webpack config file, however, it is hard to access it directly. The file is located inside the folder of node modules:

We can also make use of npm run eject directly to get…

Continue Reading

Python

Hands On Machine Learning – Example 1.1 with CSV

Required CSV oecd_bli_2015.csv gdp_per_capita.csv   prepare_country_stats()

  Completed code for example 1.1

  Plotting using sklearn.linear_model.LinearRegression():                         Plotting using sklearn.neighbors.KNeighborsRegressor()with sampling n = 3:

std

std::vector

Declaration

  Simple operation

  Fill with something

  Combine two vectors

  In-place solution for creating object

Originally, object gets created first in the main stack and then copied to the vector’s memory address

In-place object creation can be achieved and save the computing time for copying the object

 

Algorithms, C++

My dynamic programming journey [2] – Coin change problem

As suggested in both Quora and StackOverflow, the coin change problem should be the second problems for beginner to solve. There are actually multiple variations of this problem, however, my approach will be finishing the basic version first, which is: Given a set of coins with values, find the possible way to form N (order is not considered). Example: Given…

Continue Reading

Algorithms, C++

My dynamic programming journey [1] – Fib with memorization

It is rather complicated to consider the advance level of dynamic programming at the beginning, so I have decided to start with a basic example: finding Fibonacci numbers. Since the concepts of recursion and memorization are often required in dynamic programming, therefore, I have implemented a version of memorization. Set base case of 0 and 1 equal to 1 Check…

Continue Reading

Fix, Python

[Debug] no name in module error in pylint and flask

Problem The following errors occur in visual code editor

  Solution It should be an import error of from urllib.request import urlopen, which I am trying to use modern python3 library. Similarly, same errors keep popping up during the bootstrap of flask server. It can be concluded that the error is caused by the conflicts of python version, which the…

Continue Reading

C, Linux

[libressl] Generate RSA key

In the latest version of libressl, RSA_generate_key is deprecated, RSA_generate_key_ex should be implemented instead. Implementation (updated) Source file (test.c)

  To compile and run the program, the library libcrypto should be imported

  Expected output

    Implementation (deprecated) Source file (test.c)

C, Linux

[libressl] Setup

SETUP Install the dependencies first

  Clone the repository from Github

  Prepare the source tree

  Configure the source tree and compile the libressl

  Install the libressl under ${HOME}/opt/libressl

  The following error will arise if the library is not written to linked library config file

  To avoid the above error

Continue Reading

Algorithms, C++

Breadth first search

Steps: Add root to queue If left child not null, add it to queue If right child not null, add it to queue Repeat 2 & 3 until the queue is empty

 

C, C++, Language

CMake command

Set variable Basic usage of SET

  To include existing variables in the SET

  To include multiple items in SET

  Include include path (header)   Suppose we have the header files like this

  To globally add the include path, use include_directories

  To specially add the include path for target, use target_include_directories

Continue Reading