小编sul*_*ing的帖子

如何更正虚拟机安装

以下是virtualbox从终端运行时错误输出的方式.怎么纠正呢?我在Ubuntu 12.10 64位机器上.

virtualbox
WARNING: The character device /dev/vboxdrv does not exist.
     Please install the virtualbox-ose-dkms package and the appropriate
     headers, most likely linux-headers-generic.

     You will not be able to start VMs until this problem is fixed.
Run Code Online (Sandbox Code Playgroud)

编辑:

我有最新的linux-headers-genericvirtualbox-ose-dkms

ubuntu virtualbox apt-get

60
推荐指数
3
解决办法
5万
查看次数

计算两个变量单个简单方程解集的算法

假设我有一个简单的形式方程式:

7x + 4y = n
Run Code Online (Sandbox Code Playgroud)

其中n由我们选择,x,y和n都是正整数.这是给我们的唯一方程式.在可能的解决方案中,我们需要解决方案(x,y),其中x是最小的.例如

7x + 4y = 14, then (2, 0) is the solution
7x + 4y = 15, then (1, 2) is the solution
7x + 4y = 32, then (4, 1) and (0, 8) are the possible solutions,
of which (0, 8) is the correct solution
Run Code Online (Sandbox Code Playgroud)

我想设计一种算法,以尽可能少的运行时间来计算它.我想到的当前算法是这样的:

Given an input n
Calculate max(x) = n/7
for i = 0 to max(x)
    If the equation 7*i + 4*y = n holds
        return value of i …
Run Code Online (Sandbox Code Playgroud)

java algorithm math

13
推荐指数
2
解决办法
2290
查看次数

Java.util.ArrayList.sort()排序算法

我正在查看grepcode上java.util.ArrayListsort()方法的源代码.他们似乎在小型数组(大小<7)上使用插入排序,并在大型数组上进行合并排序.我只是想知道这是否会产生很大的不同,因为它们只对大小<7的数组使用插入排序.在现代机器上,运行时间的差异几乎不可察觉.

我在Cormen读过这篇文章:

尽管合并排序在O(n*logn)最坏情况下运行,插入排序在O(n*n)最坏情况下运行,但插入排序中的常数因素可以使其在实际中对于许多机器上的小问题大小更快.因此,当子问题变得足够小时,通过在合并排序中使用插入排序来粗化递归的叶子是有意义的.

如果我会为我需要的某个组件设计排序算法,那么在合并排序与运行时间的差异变得明显之前,我会考虑使用insert-sort来获得更大的大小(可能达到<100).

我的问题是,达到<7的大小背后的分析是什么?

java algorithm math

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

gevent + gunicorn是否可扩展且稳定用于生产?

我一直在研究提供可扩展性的python web服务器,并决定使用Tornado(由Facebook FriendFeed使用)或Gevent.由于我对此很陌生,我依靠Python Web服务器基准来列出Tornado和Gevent.此外,经过进一步研究,我发现:

  • Gevent不是一个独立的Web服务器,我们需要使用libevent或gunicorn作为Web服务器.
  • libevent有它的缺陷,例如不支持SSL,流媒体,保持活动和websockets.
  • 没有基准测试结果,我可以找到哪些文件gevent和gunicorn的性能一起使用.
  • gevent的作者本人建议大家使用gevent + gunicorn进行实际部署.

我的要求:

  • 高度可扩展的异步python Web服务器.
  • 包括SSL支持.

由于其基于greenlet的方法,我特别倾向于gevent .我只是想要一些确凿的事实来证明gunicorn + gevent是一个不错的选择,并且在与Tornado的联盟中具有高度的可扩展性.或者是否有其他符合我要求的python web服务器?

请指出我正确的方向.

python webserver tornado gevent gunicorn

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

标签 统计

algorithm ×2

java ×2

math ×2

apt-get ×1

gevent ×1

gunicorn ×1

python ×1

tornado ×1

ubuntu ×1

virtualbox ×1

webserver ×1