小编Pau*_*omé的帖子

为什么redis中hashmap的负载因子高达5

在算法类和授权书籍中,负载因子小于 1,就像 Java 一样,默认值为 0.75。但在redis源代码中,负载因子是5。

54 /* Using dictEnableResize() / dictDisableResize() we make possible to
55  * enable/disable resizing of the hash table as needed. This is very important
56  * for Redis, as we use copy-on-write and don't want to move too much memory
57  * around when there is a child performing saving operations.
58  *
59  * Note that even when dict_can_resize is set to 0, not all resizes are
60  * prevented: a hash table is …
Run Code Online (Sandbox Code Playgroud)

hashmap redis load-factor

3
推荐指数
1
解决办法
532
查看次数

Eval和词汇变量

我正在做一个小项目只是为了好玩,我添加eval了对它的支持,使调试更容易.但后来我发现了一个问题:

(let ((x 1))
    (eval (1+ x)))

(defun foo (x form)
    (eval form))
(foo 1 '(1+ x))
Run Code Online (Sandbox Code Playgroud)

上面的代码不起作用.有人可以解释为什么以及如何解决它?非常感谢.

lisp eval common-lisp

2
推荐指数
1
解决办法
147
查看次数

将跟踪写入文件

我一直试图通过设置*trace-output*为文件生成的流来编写结果

(setf *trace-output* (open "log.txt"))
Run Code Online (Sandbox Code Playgroud)

但这失败了Error: Unexpected end of file on #<BASIC-FILE-CHARACTER-INPUT-STREAM.

所以,问题是 - 有没有办法将trace的结果写入文件?

lisp common-lisp

1
推荐指数
1
解决办法
358
查看次数

奇怪的行为调用破坏性的公共LISP函数接收使用quote创建的列表作为参数

我一直在调用一个破坏性的定义时接受一个奇怪的行为,接收一个局部变量作为参数,其类型是一个用引号创建的列表.

破坏性功能:

(defun insert-at-pos (pos list elem)
  (if (= pos 0)
      (cons elem list)
      (let ((aux-list (nthcdr (1- pos) list)))
        (setf (rest aux-list) (cons elem (rest aux-list)))
        list)))
Run Code Online (Sandbox Code Playgroud)

错误:局部变量是使用特殊运算符引号创建的列表.

(defun test ()
 (let ((l '(1 2 3)))
   (print l)
   (insert-at-pos 2 l 4)
   (print l))) 

> (test)

(1 2 3)
(1 2 4 3)
(1 2 4 3)

> (test)

(1 2 4 3)
(1 2 4 4 3)
(1 2 4 4 …
Run Code Online (Sandbox Code Playgroud)

lisp list common-lisp quote

1
推荐指数
1
解决办法
178
查看次数

如果选中,则获取复选框值

我正在使用带有JQuery mobile的HTML构建表单,以便表单可以在移动设备上使用.

我有通过电子邮件导出到CSV的表单.但是,如果未选中"复选框",则不会写入CSV文件.

我是否可以使用jQuery中的函数从已选中的复选框中提取值,使用标签中的值,并将未选中的框标记为Null或作为a,Space以便在将它们导入Excel时,它会注意到未检查值?

<label for="question4" class="input"> 4. What language (s) are you currently using? </label>
<fieldset data-role="controlgroup">
    <legend>Multi select:</legend>
    <input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" value="english"/>
    <label for="checkbox-1"> English</label>
    <input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom" />
    <label for="checkbox-2">French</label>
    <input type="checkbox" name="checkbox-3" id="checkbox-3" class="custom" />
    <label for="checkbox-3">Spanish</label>
    <input type="checkbox" name="checkbox-4" id="checkbox-4" class="custom" />
    <label for="checkbox-4">Brazilian Portuguese</label>
    <input type="checkbox" name="checkbox-5" id="checkbox-5" class="custom" />
    <label for="checkbox-5">Italian</label>
    <input type="checkbox" name="checkbox-6" id="checkbox-6" class="custom" />
    <label for="checkbox-6">German</label>
    <input type="checkbox" name="checkbox-7" id="checkbox-7" class="custom" /> …
Run Code Online (Sandbox Code Playgroud)

html javascript php jquery

1
推荐指数
1
解决办法
7万
查看次数

在MySQL中设计数据库时的最佳实践

我正在使用Java EE开发企业应用程序,我认为它将拥有大量的存储数据.它类似于大学管理应用程序,其中所有大学学生都已注册并具有其个人资料.

我正在使用MySQL数据库.我试图在互联网上探索,我在这个链接上找到了一些提示.

开发大型数据库以避免其性能下降的最佳实践是什么?

提前致谢.

mysql database database-design java-ee

0
推荐指数
1
解决办法
1万
查看次数