上一页 1 2 3 4 5 6 ··· 18 下一页
摘要: 目录 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 孤独信徒 阅读(69) 评论(0) 推荐(0) 编辑
摘要: MYSQL在创建一个带有自增主键ID的表时,通常在删除数据时,导致自增主键不连续了。使用下面的SQL脚本可以重置主键。 -- 1、重置已有数据主键 SET @rownum = 0; UPDATE table_name SET id = @rownum := @rownum +1; -- 2、修改自增 阅读全文
posted @ 2022-07-26 09:42 孤独信徒 阅读(826) 评论(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 孤独信徒 阅读(17) 评论(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 孤独信徒 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 列表解析 (List comprehensions) 是erlang中的语法糖,同样,在elixir中也有对应的语法。 在很多時候,解析可以用来叠代产生更简洁的语句。让我们先来看一个简单的解析,然后拆解它的结构:EnumStream iex> list = [1, 2, 3, 4, 5] iex> 阅读全文
posted @ 2022-06-24 11:27 孤独信徒 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 一、Git安装: 1、 二进制方式安装: $ sudo apt-get install git-core 安装完成后,在终端中输入 git 就可以看到相关的命令了。如果只是需要使用git来管理本地的代码,那么现在 就 可 以使用了。如果需要和github上的项目结合,还需要做其他的一些操作。 2、g 阅读全文
posted @ 2022-06-22 17:19 孤独信徒 阅读(678) 评论(0) 推荐(0) 编辑
摘要: Linux下路径可以变一下,例如数据库gaomart的表结构导出: Windows里 mysqldump -d -uroot -p123456 gaomart>d:/gaomart.sql Linux里 mysqldump -d -uroot -p123456 gaomart>/home/liang 阅读全文
posted @ 2022-06-21 12:02 孤独信徒 阅读(1278) 评论(0) 推荐(0) 编辑
摘要: 在本地windows11环境下,mix compile 编译某个项目时,遇到个问题,报错信息如下: **(Mix) “nmake ” not found in the path. If you have set the MAKE enviroment variable. 具体信息如下图: 由于本人用 阅读全文
posted @ 2022-06-17 14:02 孤独信徒 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 内存泄漏类型 process泄漏 如果没有etop iex(xxxx@xxxx.)1> :erlang.system_info(:process_count) 5369 可以通过process_count来获取erlang vm中已分配的process数量. 若process数量和业务实际需要不吻合 阅读全文
posted @ 2022-06-17 10:18 孤独信徒 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 在Elixir中使用文件系统与使用其他流行的编程语言进行操作实际上并没有什么不同。 有三个模块可以解决此任务: IO , File和Path 。 它们提供了打开,创建,修改,读取和销毁文件,扩展路径等功能。但是,您应该注意一些有趣的陷阱。 在本文中,我们将在看一些代码示例的同时谈论在Elixir中使 阅读全文
posted @ 2022-06-17 10:13 孤独信徒 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 备注: 首先需要安装 elixir 环境 1. 基本项目说明 参考项目: https://github.com/rongfengliang/phoenix-rest-demo 2. 项目说明 备注: 主要是插件的配置 mix.exs defp deps do [ {:phoenix, "~> 1.3 阅读全文
posted @ 2022-06-16 09:20 孤独信徒 阅读(39) 评论(0) 推荐(0) 编辑
摘要: Hex https://hex.pm 包含了 erlang和elixir的 如果再项目里需要某些包的依赖,可以从这里查看版本和doc 文档。 阅读全文
posted @ 2022-06-15 17:46 孤独信徒 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 比如 某个请求是http:// localhost:4000提供的,但是我们的前端应用程序将在http:// localhost:3000上运行 。 这样,就涉及到CORS跨域问题了, 为处理这个跨域错误,我们需要安装第三方库 {:cors_plug, "~> 1.1"},然后在sling/api/ 阅读全文
posted @ 2022-06-15 17:40 孤独信徒 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 方式:根据erlang:send_after 启动个定时器,在gen_server 里面实现它。 直接上个测试代码: 在init初始化的时候,启动个timer,间隔时间为3秒 并输出打印 。 defmodule Distro.Cron do use GenServer require Logger 阅读全文
posted @ 2022-06-15 11:54 孤独信徒 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 可根据 mix help 查询 mix # Runs the default task (current: "mix run") mix app.config # Configures all registered apps mix app.start # Starts all registered 阅读全文
posted @ 2022-06-15 09:59 孤独信徒 阅读(84) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 18 下一页