上一页 1 2 3 4 5 6 ··· 18 下一页
摘要: VSCODE安装GO插件、go tools及settings.json配置流程 1. VSCODE插件库安装GO插件 2. 安装Go插件所依赖的go tools,上面的go插件会提示你安装它的一些依赖及工具。 如果没有提示,可以点击右下角 Analysis Tools Missing。最后点击 In 阅读全文
posted @ 2023-02-28 09:38 孤独信徒 阅读(2047) 评论(0) 推荐(0)
摘要: prometheus学习笔记(1)-mac单机版环境搭建 注:以下所有环境均为mac笔记本 一、安装prometheus brew install prometheus 1. 安装完后,默认的安装路径为: /opt/homebrew/Cellar/prometheus/2.16.0/ /usr/lo 阅读全文
posted @ 2023-02-16 13:36 孤独信徒 阅读(206) 评论(0) 推荐(0)
摘要: 对web服务来说, 上传文件图片,是个常用功能,打个样,简单试下效果: 在 postman上做个实验,如下图,再在本地路径下查看下: 在router.ex 里 配置个路由的路径, 再到controller里面,简单写下,共4行代码 1 def upload_photo(conn, body_para 阅读全文
posted @ 2022-11-16 18:07 孤独信徒 阅读(47) 评论(0) 推荐(0)
摘要: defmodule Gateway.Http do def post(conn, url, content) do headers = headers(conn) case HTTPoison.post(url, content, headers) do {:ok, %HTTPoison.Respo 阅读全文
posted @ 2022-10-08 16:35 孤独信徒 阅读(21) 评论(0) 推荐(0)
摘要: 1.rex 是什么? rex 是 kernrl进程树第2个启动的进程主要提供rpc服务,系统的所有rpc远程调用,都会经过rex 2.rex 创建 % kernel.erl Rpc = #{id => rex, start => {rpc, start_link, []}, restart => p 阅读全文
posted @ 2022-10-08 11:05 孤独信徒 阅读(245) 评论(0) 推荐(0)
摘要: 1) 原子转字符串: Elixir语言中 Atom.to_string 相关用法介绍如下。 用法: to_string(atom) @spec to_string(atom()) :: String.t() 将原子转换为字符串。 由编译器内联。 例子 iex> Atom.to_string(:foo 阅读全文
posted @ 2022-10-08 09:49 孤独信徒 阅读(101) 评论(0) 推荐(0)
摘要: 确保已经安装erlang/otp,这是rebar3编译安装前提条件 【1】安装 git clone https://github.com/erlang/rebar3.gitcd rebar3./bootstrap./rebar3 local install 安装完成提示: > Extracting 阅读全文
posted @ 2022-09-20 15:35 孤独信徒 阅读(365) 评论(0) 推荐(0)
摘要: `mix.exs` 文件中的 application 设置选项 :extra_applications需要在你的应用之前启动的应用. :registered你的应用中使用到的进程注册名. 用于解决不同应用中的进程名冲突. :env默认的环境. :applications在运行时, 你的应用所依赖的所 阅读全文
posted @ 2022-09-16 14:54 孤独信徒 阅读(54) 评论(0) 推荐(0)
摘要: 在libcluster项目里,有关于crypto的加解密的东西,包括 encrypt和decrypt, 向量IV,key,和填充等基础概念,和erlang的调用差无二意 直接上代码: 1 defp encrypt(_state, plaintext, password) do 2 iv = :cry 阅读全文
posted @ 2022-09-16 14:06 孤独信徒 阅读(44) 评论(0) 推荐(0)
摘要: Phoenix: Plug.Conn 前端速查表 Request conn.host # → "example.com" conn.method # → "GET" conn.path_info # → ["posts", "1"] conn.request_path # → "/posts/1" 阅读全文
posted @ 2022-09-09 10:41 孤独信徒 阅读(40) 评论(0) 推荐(0)
摘要: 目录 all? any? chunk_every/2 chunk_by map_every each map min max reduce sort uniq_by Enum Enum 模块提供了超过一百个函数,和集合交互。 iex iex> Enum.__info__(:functions) |> 阅读全文
posted @ 2022-08-29 13:46 孤独信徒 阅读(80) 评论(0) 推荐(0)
摘要: MYSQL在创建一个带有自增主键ID的表时,通常在删除数据时,导致自增主键不连续了。使用下面的SQL脚本可以重置主键。 -- 1、重置已有数据主键 SET @rownum = 0; UPDATE table_name SET id = @rownum := @rownum +1; -- 2、修改自增 阅读全文
posted @ 2022-07-26 09:42 孤独信徒 阅读(887) 评论(0) 推荐(0)
摘要: # a = %{ # "mami" => ["a", "d"], # "star" => ["c", "b"]} # b = %{"a" => "1", # "b" => ["2","3","4"], # "c" => ["5","6"], # "d" 阅读全文
posted @ 2022-07-25 12:16 孤独信徒 阅读(22) 评论(0) 推荐(0)
摘要: 冒泡排序: defmodule BubbleSort do @moduledoc """ Implementation of BubbleSort algorithm (https://en.wikipedia.org/wiki/Bubblesort) Given an array of numbe 阅读全文
posted @ 2022-06-24 17:01 孤独信徒 阅读(42) 评论(0) 推荐(0)
摘要: 列表解析 (List comprehensions) 是erlang中的语法糖,同样,在elixir中也有对应的语法。 在很多時候,解析可以用来叠代产生更简洁的语句。让我们先来看一个简单的解析,然后拆解它的结构:EnumStream iex> list = [1, 2, 3, 4, 5] iex> 阅读全文
posted @ 2022-06-24 11:27 孤独信徒 阅读(143) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 18 下一页