小编Ada*_*zyk的帖子

用play安装postgresql!框架(未找到驱动程序:[org.postgresql.Driver])

我是戏剧的新手!框架和postgresql,我试图让它工作.

我在stackoverflow上阅读了很多问题,我在google上搜索了很多但是我没有设法让它工作.

这是Play的错误!给我 :

Driver not found: [org.postgresql.Driver] 
Run Code Online (Sandbox Code Playgroud)

我的问题是:

1)你知道一个简单的教程(即从头开始解释),它展示了如何配置游戏!使postgresql工作?我读了很多东西,但没有找到详细的教程.

2)如果没有,这是我的配置:

我添加了这个application.conf:

db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://127.0.0.1/postgres"
db.default.user=postgres
db.default.password=root
Run Code Online (Sandbox Code Playgroud)

并在built.sbt:

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
)  
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

postgresql playframework

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

C++传递枚举作为参数

如果我有一个像这样的简单类用于卡:

class Card {
        public:
            enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES };
            Card(Suit suit);
    };
Run Code Online (Sandbox Code Playgroud)

然后我想在另一个文件中创建一个卡的实例如何通过枚举?

#include "Card.h"
using namespace std;
int main () {
    Suit suit = Card.CLUBS;
    Card card(suit);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

错误:此范围内未声明'Suit'

我知道这有效:

#include "Card.h"
using namespace std;
int main () {
    Card card(Card.CLUBS);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但是如何在另一个文件中创建Suit类型的变量?

c++ parameters enums

11
推荐指数
2
解决办法
5万
查看次数

每个android进程获得多少内存?

我们可以依靠我们的Android应用程序获取一定数量的内存,还是在手机型号或操作系统版本之间有所不同?

例如,我有一个内存缓存,我已将其限制设置为5 MB.如果在一台设备上,我的应用程序只能获得8 MB内存,而在另一台设备上,24 MB,我想调整内存缓存的上限以利用更多或更少的内存.

有没有办法解决这个问题,金额是否会有所变化?

memory android

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

多重继承和多态问题

考虑这个C++代码:

#include <iostream>
using namespace std;

struct B {
    virtual int f() { return 1; }
    int g() { return 2; }
};
struct D1 : public B { // (*)
    int g() { return 3; }
};
struct D2 : public B { // (*)
    virtual int f() { return 4; }
};
struct M : public D1, public D2 {
    int g() { return 5; }
};

int main() {
    M m;
    D1* d1 = &m;
    cout << …
Run Code Online (Sandbox Code Playgroud)

c++ multiple-inheritance

11
推荐指数
2
解决办法
800
查看次数

Haskell中的高效哈希映射容器?

我想使用Haskell计算存储在文件中的唯一块.该块只是连续的字节,长度为512,目标文件的大小至少为1GB.

这是我最初的尝试.

import           Control.Monad
import qualified Data.ByteString.Lazy as LB
import           Data.Foldable
import           Data.HashMap
import           Data.Int
import qualified Data.List            as DL
import           System.Environment

type DummyDedupe = Map LB.ByteString Int64

toBlocks :: Int64 -> LB.ByteString -> [LB.ByteString]
toBlocks n bs | LB.null bs = []
              | otherwise = let (block, rest) = LB.splitAt n bs
                            in block : toBlocks n rest

dedupeBlocks :: [LB.ByteString] -> DummyDedupe -> DummyDedupe
dedupeBlocks = flip $ DL.foldl' (\acc block -> insertWith (+) block 1 $! acc) …
Run Code Online (Sandbox Code Playgroud)

haskell unordered-map hashtable hashmap

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

其他进程调用GC会减慢我的游戏速度

我正在为Android> = 2.1编写一个实时街机游戏.在游戏过程中我不分配内存,不引诱GC.如果GC调用,它需要处理器70-200ms.用户将此视为"哦不,那场比赛已经落后......".

我检查了LogCat.有很多GC_FOR_MALLOC或GC_EXPLICIT.但是......不是来自我的过程的PID!我的游戏不会导致他们.它们是因为其他进程在后台运行而引起的.一些壁纸,小工具,收音机,电子邮件,天气检查和其他服务......

我完全不明白.我猜想,当例如壁纸消失,其onPause()被调用时.因此,它应该停止所有线程,当然不分配任何内存(或调用System.gc()).也许这是错误的实施?我不知道.但也有一些Android服务,它们也不时引起GC ......这很奇怪.

这是一个很大的Android <= 2.2架构缺陷吗?Android 2.3 引入了并发GC,花费的时间更少.

我该怎么做才能确保我的游戏顺利运行?

android garbage-collection

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

amxn网格上存在多少个子矩形

给定m x n网格,这样的网格上存在多少个唯一的子矩形?

例如,

1 x 1 网格有1个子矩形.

1 x 2 网格有3个子矩形.

我正在寻找一个可用于直接计算现有子矩形数的通用公式.

algorithm

11
推荐指数
3
解决办法
2万
查看次数

$ icon-font-path如何在bootstrap scss中运行?

我最近开始在我的节点项目上使用bootstrap SCSS.所以我app/bower_components/bootstrap-sass/lib/_glyphicons.scss举个例子.

看看我的CSS输出,我看到的内容如下:

@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/some\/path\/project\/app\/bower_components\/bootstrap-sass\/lib\/_normalize\.scss}line{font-family:\0000332}}
audio,
canvas,
video {
  display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)

我有两个问题:

  1. 这似乎是一个安全漏洞.每个人都可以通过查看我的CSS来推断出我的操作系统和目录结构.关闭此安全漏洞的正确方法是什么?
  2. 它是如何工作的?我差点搞清楚,但我错过了一些东西.看看SCSS,我看到bootstrap正在使用$icon-font-path,它显然变成了这个绝对路径.看看指南针文档,我看到它们提供绝对值,但没有$icon-font-path

这是我所指的一段代码:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('#{$icon-font-path}#{$icon-font-name}.eot');
  src: url('#{$icon-font-path}#{$icon-font-name}.eot?#iefix') format('embedded-opentype'),
       url('#{$icon-font-path}#{$icon-font-name}.woff') format('woff'),
       url('#{$icon-font-path}#{$icon-font-name}.ttf') format('truetype'),
       url('#{$icon-font-path}#{$icon-font-name}.svg#glyphicons-halflingsregular') format('svg');
}
Run Code Online (Sandbox Code Playgroud)

bootstrap-sass compass-sass

11
推荐指数
3
解决办法
2万
查看次数

如果Annotation是一个接口,那么它如何扩展Object类?

我们将注释定义为接口,如下所示

@interface annot_name {

}
Run Code Online (Sandbox Code Playgroud)

我们知道所有注释都java.lang.annotation.Annotation默认扩展接口.

当我检查java库的Annotation接口时,我发现它覆盖了许多Object类的方法,比如hashCode()等.

如果Annotation是一个接口,那么它如何扩展Object类并覆盖其方法呢?接口只能扩展其他接口而不能扩展类.

java annotations

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

Java内部和嵌套类

我已经开始准备自己参加OCJP7考试,我发现这一章看起来很复杂.

假设我有这段代码:

class Outer1{
    interface InnerInterface{
        String x = "test";
    }
    class InnerClass{
        String x = "test";
    }
}
class Outer2{
    static interface NestedInterface{
        String x = "test";
    }
    static class NestedClass{
        String x = "test";
    }
}
class Main{
    public static void main(String [] args){
        String s1 = Outer1.InnerInterface.x;
        String s2 = new Outer1().new InnerClass().x;
        String s3 = Outer2.NestedInterface.x;
        String s4 = new Outer2.NestedClass().x;
    }
}
Run Code Online (Sandbox Code Playgroud)

你能告诉我,为什么我们可以访问Outer1.InnerInterface.x,并Outer2.NestedInterface.x以同样的方式?内部接口默认是静态的?我正试图建立一些联系,以使它们更清晰.

java class

11
推荐指数
2
解决办法
519
查看次数