Categories
Elixir

Install Elixir Phoenix Framework in Ubuntu 20.04 Focal Fossa

Here is a quick steps of Phoenix Framework installation in Ubuntu 20.04 – Focal Fossa ready for website development. In summary, the steps will install the Erlang, Elixir, Phoenix Framework and PostgreSQL.

1. Erlang and Elixir Installation
First, lets install Erlang. When the pop-up of codename appear, please input Ubuntu 20.04 Codename which is “Focal”:

sudo dpkg -i erlang-solutions_1.0_all.deb 
sudo apt-get update
sudo apt-get install erlang
sudo apt-get install elixir
sudo apt-get install git vim
Categories
Mandarin

Windows 10 Software Term Mandarin Chinese English – Part 1

I have changed all my Windows 10 language to Mandarin as part of practicing “普通话”. It’s very hard for me to find databases that show the software or desktop translation from Chinese to English. This is including common software like Words, Excel, Teams Chat, Outlook, and Calendar.

Here is part one in which you can learn :

New file新建Xīnjiàn
Open打开dǎ kāi
File文件wén jiàn
Download下载xià zǎi
Document文档wén dàng
Images图像tú xiàng
Photos照片zhào piàn
Categories
Rust

Convert slices into String in Rust

I found it hard to find a single article to explain how to convert or merge slices to string in Rust. Here is an example of how to do it:

let row_content = &row.iter().map(|highscore| highscore.to_string()).collect::>().join(",");

I hope this helps someone who wants to concatenate slices/list in Rust into delimiter comma-separated string or only space.

Categories
Rust

Install Rust Diesel in Windows 10 and Fix Issue

Installing Diesel CLI in Windows 10 can be troublesome sometimes. When I did execute this command “cargo install diesel_cli –no-default-features –features postgres” and receive error message:

note: Non-UTF-8 output: LINK : fatal error LNK1181:error: linking with `link.exe` failed: exit code: 1181

I have tried to debug it with the various approach by:

So, I did reset my Windows 10 language and downloaded the gigantic Microsoft Visual Studio 2019 with “VC++ 2015.3 v14.00 (v140) toolset for desktop”. I did re-install rust with the hope it will solve the issue.

None of the above is works until I found someone wrote an article on how to install Diesel in Windows 10 and enable it’s CLI with the help of setup the local variable PATH.

Categories
Elixir

Simple upload file local Phoenix Elixir

There is a lack of information on how to do simple upload form in Phoenix Framework and store file into local storage. Although people recommend using Plug or external libraries, sometimes is useful to understand how essential thing work like upload image or PDF can be done using few Elixir scripts.

In this tutorial, I’m using an example of Hello project from Phoenix’s installation guideline. If you don’t have the project yet, please set-up by yourself since this tutorial does not cover it.

In the beginning, let write a path to access the upload page in the router, “lib/hello_web/router.ex”. Let use “upload” as the access path

  scope "/", HelloWeb do
    pipe_through :browser

    get "/", PageController, :index
    resources "/upload", UploadController, only: [:index, :create]
  end
Categories
Elixir

Phoenix Elixir Installation in Windows 10

Here is the full guide on how to set up and install the latest Phoenix Web Framework and Elixir in Windows 10. In this case, I’m using Windows 10 as my day to day software development environment. Please follow the steps below:

In summary, to build a new Phoenix application, we will need to install a few software :

  • the Erlang VM and the Elixir programming language
  • PostgreSQL as default preferable database
  • Node.JS for assets – which can be opt-out, especially if you are building APIs
  • Phoenix Framework
  • Cmder (my favorite terminal in Windows)
Categories
Devops

Install WordPress on AWS Ubuntu 20.04

Here is a full guide installation on how to set up WordPress with your domain using AWS route 53, EC2 and Ubuntu 20.04 – Focal Fossa. I will assume you have zero or limited understanding of how to set your blog running on a small server.

To setup this, all you need is 15 minutes have access to your CMDER or command console.. The steps are quite easy by setup domain, EC2 instance, DNS configuration, Softwares installation, NGINX configuration, Database, SSL Letsencrypt and WordPress installation