V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  MoYi123  ›  全部回复第 16 页 / 共 17 页
回复总数  333
1 ... 8  9  10  11  12  13  14  15  16  17  
尾递归只是把原先的函数调用栈放到参数里而已,所有的递归在参数中加一个栈都可以改成尾递归。
2020-08-08 11:01:00 +08:00
回复了 angryfish 创建的主题 Erlang erlang 都是怎么调试的
想用断点的话建议用这位大佬改造过的 idea 插件,相对来说好用不少,文章里也有使用方法。
https://blog.csdn.net/eeeggghit/article/details/106021723#comments_12664319
2020-08-07 21:38:06 +08:00
回复了 angryfish 创建的主题 Erlang erlang 都是怎么调试的
我基本全靠 io:format, erlang 的话可以热更新,改完代码 c(Module)就行了,所以也挺方便的,调试线上的代码也可以使用 recon_trace:calls
2020-08-06 16:16:33 +08:00
回复了 lxk11153 创建的主题 MySQL mysql 一个字段,值是用逗号拼接的,如何查 split 后的 count 数?
长度等于逗号数 + 1
2020-08-03 17:23:40 +08:00
回复了 zzhpeng 创建的主题 MySQL 大佬们求救,慢 SQL 问题
倒数第三句 sql 看起来更加可疑。
图一乐。估计性能还是会有问题。为了方便把后缀单独弄了一列。

create table u_insert
(
id serial primary key,
key text,
value int,
suffix int default 0
);
create unique index on u_insert (key, suffix);

begin;
lock u_insert;
CREATE unlogged TABLE tmp(id serial,key text,value int) on commit drop;
insert into tmp(key, value) values ('a', 1),('a', 2),('b', 1);
insert into u_insert(key, value, suffix)
select key, value, t.suffix + rank() OVER (PARTITION BY key ORDER BY id DESC) as suffix
from tmp,
(select t.key as k, greatest(max(u_insert.suffix), t.suffix) as suffix
from u_insert right join (select unnest(array ['a','b']) as key, 0 as suffix) as t on u_insert.key = t.key group by t.key, t.suffix) as t
where t.k = key;
commit;
2020-07-26 22:43:13 +08:00
回复了 bear2000 创建的主题 程序员 做一道算法题需要花多长时间?
leetcode 的周赛里,我一般前三题 1 题简单,2 题中等用 30 分钟,第四题想一个小时,能不能做出来随缘。
https://github.com/parse-community/parse-server 里面的 dashboard
但是必须建一些它必须的表。
2020-07-21 12:07:45 +08:00
回复了 GTD 创建的主题 Python Python 如何在包内的某一个模块隐藏某一个函数呢?
inspect 模块可以看的函数的调用栈,如果上一级调用栈不是本模块的函数,就报错。
2020-07-15 14:41:49 +08:00
回复了 Evilk 创建的主题 PHP 和第三方对接,遇到点问题,求大佬解惑
让他们做个 docker 镜像发过来。
2020-07-10 11:14:03 +08:00
回复了 cat404 创建的主题 程序员 大佬们来解答一下这个面试题(语言不限)
用栈模拟战斗过程,保存战死士兵的 index,然后输出就行了
2020-06-12 11:51:45 +08:00
回复了 hejw19970413 创建的主题 LeetCode 我想问一道 LeetCode 变形题:(70)爬楼梯(变形)
三个数字的斐波那契数列
2020-06-10 00:05:15 +08:00
回复了 Visitor233 创建的主题 程序员 你在程序中用过那些数学公式?
克劳修斯-克拉贝龙公式,化工的老本行了。
2020-06-09 23:45:23 +08:00
回复了 mart1nN 创建的主题 Python 新开一个线程启动 websocket 服务端
这个 loop 要从主线程传进来。
2020-06-02 18:08:36 +08:00
回复了 allenwuli 创建的主题 数据库 PG 库,查询优化。
1. 用 copy 应该比 select 性能更好。
2. 可以考虑传输或者储存的时候压缩一下
3. 根据我的经验,in (...) 在大于 200 个左右的时候可能会出现 recheck index 的现象,最好能 explain 确定一下。
2020-05-26 19:34:08 +08:00
回复了 0x1001 创建的主题 程序员 各位好,请教个 SQL 查询问题
create table test1 (a int);
create table test2 (b int);
insert into test1 values (1);
insert into test2 values (2);

create or replace FUNCTION f(tb text, val1 integer)
returns TABLE
(
val int
)
as
$body$
BEGIN
IF EXISTS(SELECT a.attname
from pg_class c,
pg_attribute a,
pg_type t
where c.relname = tb
and a.attnum > 0
and a.attrelid = c.oid
and a.atttypid = t.oid
and a.attname = 'a') THEN
return query execute 'select a from ' || tb || ' where a = ' || val1;
ELSIF EXISTS(SELECT a.attname
from pg_class c,
pg_attribute a,
pg_type t
where c.relname = tb
and a.attnum > 0
and a.attrelid = c.oid
and a.atttypid = t.oid
and a.attname = 'b') THEN
return query execute 'select b from ' || tb || ' where b = ' || val1;
END IF;
END;
$body$
language plpgsql;

lz 可以改得简洁一点
1 ... 8  9  10  11  12  13  14  15  16  17  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1257 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms · UTC 23:15 · PVG 07:15 · LAX 16:15 · JFK 19:15
Developed with CodeLauncher
♥ Do have faith in what you're doing.