问题列表 - 第36145页

用非运算符写prolog语句

我有这样的Prolog声明

verb('part_of-8').
noun('doctor_investigation_system-2').
noun('dis-4').
berelation('be-6').
verb('be-6').
noun('hospital_information_system-11').
noun('his-13').
rel('part_of-8', 'doctor_investigation_system-2').
rel('doctor_investigation_system-2', 'dis-4').
rel('part_of-8', 'be-6').
rel('part_of-8', 'hospital_information_system-11').
rel('hospital_information_system-11', 'his-13').

associatedWith(X,Y,Z) :-
   verb(Y),
   noun(X),
   noun(Z),
   X\=Y, Y\=Z, Z\=X,
   rel(X,Y), rel(Y,Z),
   not(beralation(X)), not(beralation(Z)), not(beralation(Y)).
Run Code Online (Sandbox Code Playgroud)

我的目标是得到associationWith(X,Y,Z),其中X,Y,Z不是"be"项(berelation),但我写的上述规则不起作用,怎么做才能使它工作

prolog

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

ISO C++禁止声明'游戏'没有类型 - 可能包括问题?

编译输出:

g++ -Wall -g main.cpp `sdl-config --cflags --libs` -lSDL_mixer
In file included from Game.h:8,
                 from main.cpp:1:
DrawableObject.h:11: error: ISO C++ forbids declaration of ‘Game’ with no type
DrawableObject.h:11: error: expected ‘;’ before ‘*’ token
DrawableObject.h:13: error: expected ‘)’ before ‘*’ token
main.cpp:7: error: expected ‘}’ at end of input
main.cpp:7: error: expected unqualified-id at end of input
make: *** [all] Error 1
brett@brett-laptop:~/Desktop/SDL$ make
g++ -Wall -g main.cpp `sdl-config --cflags --libs` -lSDL_mixer
In file included from Game.h:8,
                 from main.cpp:1:
DrawableObject.h:11: …
Run Code Online (Sandbox Code Playgroud)

c++ sdl

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

渲染到iOS下的浮点纹理

iPad现在支持OES_texture_half_float 扩展.不幸的是,我无法将浮点纹理绑定到帧缓冲对象.这是我的尝试:

GLuint textureHandle;
glGenTextures(1, &textureHandle);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 256, 256, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
assert(GL_NO_ERROR == glGetError()); // this passes

GLuint fboHandle;
glGenFramebuffers(1, &fboHandle);
glBindFramebuffer(GL_FRAMEBUFFER, fboHandle);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureHandle, 0);
assert(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); // this asserts
Run Code Online (Sandbox Code Playgroud)

更换时,该工作正常GL_HALF_FLOAT_OES使用GL_UNSIGNED_BYTE.

这是iOS的限制还是我做错了什么?

iphone opengl-es

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

确定mysql中索引的状态

我在一张有3500万条记录的桌子上创建了一个新索引,现在已经运行了将近1天.以前当我创建索引花了20分钟时,然而有些列是浮动的.新的idnex在varchar(45)上

我使用了processlist命令,该命令显示索引创建仍在使用以下输出

65417 | Repair with keycache | CREATE INDEX insert_index on checkins(dateinserted)
Run Code Online (Sandbox Code Playgroud)

我想知道是否有人可以给我建议,以查明查询是否真的死了,只是坐在进程列表中.也许在某个阶段出现了问题,我不知道.

谢谢

mysql database database-indexes

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

在LINQ中,我可以选择多个项目吗?

假设我有一个string像这样的数组:

string [] foos = {
    "abc",
    "def",
    "ghi"
};
Run Code Online (Sandbox Code Playgroud)

我想要一个包含每个字符串及其反向的新集合.所以结果应该是:

    "abc",
    "cba",
    "def",
    "fed",
    "ghi",
    "ihg"
Run Code Online (Sandbox Code Playgroud)

我可以遍历数组,但这非常笨拙:

string Reverse (string str)
{
    return new string (str.Reverse ().ToArray ());
}

List<string> results = new List<string> ();
foreach (string foo in foos) {
    results.Add (foo);
    results.Add (Reverse(str));
}
Run Code Online (Sandbox Code Playgroud)

有没有办法在LINQ中执行此操作?就像是

var results = from foo in foos
    select foo /* and also */ select Reverse(foo)
Run Code Online (Sandbox Code Playgroud)

.net c# linq

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

如何在C#中将unix纪元时间和帐户转换为夏令时?

我有一个从unix纪元时间转换为.NET DateTime值的函数:

public static DateTime FromUnixEpochTime(double unixTime )
{
  DateTime d = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
  return d.AddSeconds(unixTime);
}
Run Code Online (Sandbox Code Playgroud)

我在哪里(英国),时钟在夏季时间前进一小时.

在Python中我使用time.time()(并且为了参数,现在时间是17:15:00)获得本地大纪元时间,这给了我一个值1286122500.

如果我将time.localtime()它转换回人类可读时间,使用它可以像我期望的那样转换回17:15.

如何将unix纪元时间转换回.NET DateTime值和帐户以获取当地夏令时.我上面的函数转换1286122500回16:15,这对我的地理位置不正确.

c# timezone datetime

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

Eclipse生成的equals():getOuterType()?

我有简单的类Point有两个类型的字段double.我让Eclipse 3.6生成equals()hashCode()为它生成.该equals()方法如下所示:

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    Point other = (Point) obj;
    if (!getOuterType().equals(other.getOuterType()))
        return false;
    if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
        return false;
    if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
        return false;
    return true;
}
Run Code Online (Sandbox Code Playgroud)

getOuterType看起来像这样:

private Point getOuterType() {
    return Point.this;
}
Run Code Online (Sandbox Code Playgroud)

所以问题是:getOuterType().equals(other.getOuterType())线的目的是什么?

java eclipse

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

如何在同一台PC上运行IE7和IE8?

我想在IE7和IE8上检查我的网站的屏幕.

我试图在很多网站上搜索,我发现IETester程序遵循这个网站.但它对我的网站不起作用.

那么,我如何使用其他程序或其他解决方案在同一台PC上运行IE7和IE8?

internet-explorer ie8-compatibility-mode ie8-browser-mode

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

UIScrollView内部的动态UILabel内容

我在UIScrollView中存储了UILabel(以及其他控件).我想动态填充UILabel,以便它自动扩展其高度以适应其内容.我只是想知道关于调整UILabel大小的最佳实践是什么,同时还要确保其父UIScrollView也将扩展其可滚动区域.

我试图将UILabel的#行设置为0,我读过的应该会自动扩展UILabel以适应其内容,但我没有太多运气.在重新计算UIScrollViews可滚动区域方面,我想这是在填充UILabel之后计算其子节点高度的情况.

iphone cocoa-touch uiscrollview uilabel

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

实体框架BuildContainsExpression导致内部.NET Framework数据提供程序错误1025

我正在尝试使用以下LINQ查询来对数据库(3.5 SP1)起作用:

var labelIds = new List<int> { 1, 2 };
var customersAggregatedTransactionsByType =
    (from transactions in context.TransactionSet
    from customers in context.CustomerSet
        .Where(LinqTools.BuildContainsExpression<Billing.Customer, int>(u => u.LabelId, labelIds))
    from accounts in context.AccountSet
    where customers == accounts.Customer
        && accounts.Id == transactions.Account.Id
        && transactions.DateTime >= fromDate && transactions.DateTime < toDate
    group transactions.Amount
    by new
    {
        UserAccountId = transactions.Account.Id,
        TransactionTypeId = transactions.TransactionTypeId,
        BaseAssetId = accounts.BaseAssetId
    } into customerTransactions
    select customerTransactions).ToList();
Run Code Online (Sandbox Code Playgroud)

一旦我添加,Where(LinqTools.BuildContainsExpression<Billing.Customer, int>(u => u.LabelId, labelIds))我得到以下异常:

System.InvalidOperationException:内部.NET Framework数据提供程序错误1025.

如果我删除Where(LinqTools.BuildContainsExpression<Billing.Customer, int>(u => u.LabelId, …

entity-framework internal

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