Try:

sudo apt-get install maven

如果它对你有用,就忽略这篇文章的其余部分。

介绍

我在2013年4月开始安装我的Ubuntu 12.10,当时正常的sudo apt-get安装maven还不能用于maven 3。

如果你想深入了解你的ubuntu内核,了解apt-get以及它在哪里找到可供安装的应用程序列表,这篇文章中的手动安装是很有用的 . 如果你在Ubuntu 12.10时遇到了和我一样的问题,它也可能对Ubuntu 15.04等最新版本有用。

通过apt-get自动安装:

如果您当前的ubuntu不能通过普通的“apt-get install maven”安装maven,请检查手动安装。

sudo apt-get update
sudo apt-get install maven

如果你的ubuntu不是最新的,或者你以前使用过maven 2,请确保删除maven 2:

sudo apt-get remove maven2

手动安装通过apt-get添加maven 3资源库(Ubuntu 14.04检查更新1):

如果你的ubuntu apt-get存储库列表不是最新的,这是很有用的。

安装系统需要Maven 3,而且大多数文档都是关于如何将Maven安装到Ubuntu 12.04或之前版本的。我找到的最好的文件是:

杀手罗非鱼的博客

我想到的整个过程如下:

sudo -H gedit /etc/apt/sources.list 添加以下行源代码。文件列表: Deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu精密主 Deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu精密主 Sudo apt-get update && Sudo apt-get install maven3 Sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn

警告1:命令“sudo apt-add-repository ppa:natecarlson/maven3”在我的Ubuntu上不起作用,必须运行sudo apt-add-repository -rm ppa:natecarlson/maven3才能让我的apt-get再次工作。 警告2:感谢David,在运行第4步之前,您需要删除到以前版本maven的现有符号链接。

OS X安装

我决定添加OS X安装,以防您为开发人员使用多个环境:请参阅源stackoverflow线程了解更多详细信息。

安装相当于apt-get的Homebrew,然后使用以下命令安装Maven:

brew install maven

更新1:ubuntu 14.04的安装

我自己没有尝试过,但我相信这应该可以在没有安全警告的情况下工作:

sudo apt-get purge maven maven2 maven3
sudo apt-add-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3

注意:来源在这里,非常感谢@rendybjunior, @Dominic_Bartl和@FunThomas424242

战舰!

早在2003年(当时我17岁),我参加了一场《战舰》AI编码比赛。尽管我输了那场比赛,但我从中获得了很多乐趣,也学到了很多东西。

现在,我想恢复这个比赛,在搜索最好的战舰AI。

下面是这个框架,现在托管在Bitbucket上。

获胜者将获得+450声望奖励!比赛将于2009年11月17日开始。17号零时之前的投稿和编辑将不被接受。(中央标准时间) 尽早提交你的作品,这样你就不会错过机会!

为了保持这个目标,请遵循比赛的精神。

游戏规则:

游戏在10x10的网格上进行。 每个参赛者将5艘船(长度为2、3、3、4、5)中的每一艘放在他们的网格上。 没有船只可以重叠,但它们可以相邻。 然后选手们轮流向对手射击。 游戏的一个变体允许每次齐射多次,每艘幸存的船一次。 如果击球沉、命中或未命中,对手将通知选手。 当任何一名玩家的所有船只都沉没时,游戏就结束了。

比赛规则:

The spirit of the competition is to find the best Battleship algorithm. Anything that is deemed against the spirit of the competition will be grounds for disqualification. Interfering with an opponent is against the spirit of the competition. Multithreading may be used under the following restrictions: No more than one thread may be running while it is not your turn. (Though, any number of threads may be in a "Suspended" state). No thread may run at a priority other than "Normal". Given the above two restrictions, you will be guaranteed at least 3 dedicated CPU cores during your turn. A limit of 1 second of CPU time per game is allotted to each competitor on the primary thread. Running out of time results in losing the current game. Any unhandled exception will result in losing the current game. Network access and disk access is allowed, but you may find the time restrictions fairly prohibitive. However, a few set-up and tear-down methods have been added to alleviate the time strain. Code should be posted on stack overflow as an answer, or, if too large, linked. Max total size (un-compressed) of an entry is 1 MB. Officially, .Net 2.0 / 3.5 is the only framework requirement. Your entry must implement the IBattleshipOpponent interface.

得分:

Best 51 games out of 101 games is the winner of a match. All competitors will play matched against each other, round-robin style. The best half of the competitors will then play a double-elimination tournament to determine the winner. (Smallest power of two that is greater than or equal to half, actually.) I will be using the TournamentApi framework for the tournament. The results will be posted here. If you submit more than one entry, only your best-scoring entry is eligible for the double-elim.

好运!玩得开心!


编辑1: 多亏弗里德,他在飞船上发现了一个错误。是否是可用的函数。问题已经解决了。请下载框架的更新版本。

编辑2: 由于人们对将统计数据持久化到磁盘等非常感兴趣,所以我添加了一些非计时设置和删除事件,它们应该能够提供所需的功能。这是一个半突破性的变化。也就是说:修改了接口,添加了功能,但不需要body。请下载框架的更新版本。

编辑3: 错误修复1:GameWon和GameLost只在超时的情况下被调用。 错误修复2:如果引擎在每一款游戏中都暂停计时,那么竞争将永远不会结束。 请下载框架的更新版本。

编辑4: 比赛结果:

我发现在《吃豆人》中有很多关于幽灵AI的参考,但没有一个提到当幽灵被《吃豆人》吃掉后,眼睛是如何找到中央幽灵洞的。

在我的实现中,我实现了一个简单但糟糕的解决方案。我只是在每个角落都用硬编码标明了应该往哪个方向走。

有没有更好的/最好的解决办法?也许是适用于不同关卡设计的通用设计?

新的SwiftUI教程有以下代码:

struct ContentView: View {
    var body: some View {
        Text("Hello World")
    }
}

第二行是单词some,在他们的网站上突出显示,就好像它是一个关键字一样。

Swift 5.1似乎没有把some作为关键字,而且我不知道some这个词还能在那里做什么,因为它在类型通常的位置。有没有一个新的、未公布的Swift版本?它是一个我不知道的被用在类型上的函数吗?

关键字有的作用是什么?

有没有办法在PostgreSQL中编写不区分大小写的查询,例如,我想下面3个查询返回相同的结果。

SELECT id FROM groups where name='administrator'

SELECT id FROM groups where name='ADMINISTRATOR'

SELECT id FROM groups where name='Administrator'

$_SERVER['HTTP_HOST']和$_SERVER['SERVER_NAME']在PHP中的区别是什么?

什么时候你会考虑使用其中一种而不是另一种,为什么?

在阅读它之后,这不是显式与隐式SQL连接的副本。 答案可能相关(甚至相同),但问题是不同的。


它们之间有什么不同?每一种都应该有什么不同?

如果我正确地理解了这个理论,那么查询优化器应该能够互换地使用这两种方法。

我知道梯度下降和反向传播算法。我不明白的是:什么时候使用偏见是重要的,你如何使用它?

例如,在映射AND函数时,当我使用两个输入和一个输出时,它不会给出正确的权重。然而,当我使用三个输入(其中一个是偏差)时,它给出了正确的权重。

我最近偶然发现了2048游戏。通过在四个方向中的任何一个方向上移动类似的平铺,可以合并它们,以生成“更大”的平铺。每次移动后,一个新的平铺显示在随机的空位置,值为2或4。当所有的方块都被填满并且没有可以合并平铺的移动,或者你创建了一个值为2048的平铺时,游戏终止。

首先,我需要遵循一个明确的战略来实现目标。所以,我想为它写一个程序。

我当前的算法:

while (!game_over) {
    for each possible move:
        count_no_of_merges_for_2-tiles and 4-tiles
    choose the move with a large number of merges
}

我所做的是,在任何时候,我都会尝试将值为2和4的平铺合并,也就是说,我尝试尽可能少地使用2和4个平铺。如果我这样做,所有其他平铺都会自动合并,策略似乎很好。

但是,当我实际使用这个算法时,在游戏结束之前,我只得到了大约4000分。AFAIK的最高分数略高于20000分,这比我目前的分数要大得多。有比上述更好的算法吗?