问题列表 - 第35932页

Ubuntu:如何安装flex来制作postgres?

我正在尝试使用ubuntu 10.04在本地使用postgresql.我配置后出现此错误

./configure --enable-cassert --enable-debug --prefix=$HOME/pgsql
Run Code Online (Sandbox Code Playgroud)

当我做&& make install我得到这个错误:

make -C parser all
make[3]: Entering directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src/backend/parser'
Run Code Online (Sandbox Code Playgroud)
ERROR: `flex' is missing on your system. It is needed to create the
file `scan.c'. You can either get flex from a GNU mirror site
or download an official distribution of PostgreSQL, which contains
pre-packaged flex output.
Run Code Online (Sandbox Code Playgroud)
make[3]: *** [scan.c] Error 1
make[3]: Leaving directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src/backend/parser'
make[2]: *** [parser-recursive] Error 2
make[2]: Leaving directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src/backend'
make[1]: *** [all] Error 2
make[1]: Leaving directory …
Run Code Online (Sandbox Code Playgroud)

postgresql ubuntu flex-lexer

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

Scala for-comprehension返回有序地图

如何使用for-comprehension返回可以分配给有序Map的内容?这是我所拥有的代码的简化:

class Bar
class Foo(val name: String, val bar: Bar)
val myList: java.util.List[Foo] = ...
val result: ListMap[String, Bar] =
    for {
        foo <- myList
    } yield (foo.name, foo.bar)
Run Code Online (Sandbox Code Playgroud)

我需要确保我的结果是一个有序的Map,顺序是从for-comprehension返回的元组.

有了上述,我得到错误:

error: type mismatch;
found   : scala.collection.mutable.Buffer[(String,Bar)]
required: scala.collection.immutable.ListMap[String,Bar]
foo <- myList
Run Code Online (Sandbox Code Playgroud)

这编译:

class Bar
class Foo(val name: String, val bar: Bar)
val myList: java.util.List[Foo] = ...
val result: Predef.Map[String, Bar] =
    {
        for {
            foo <- myList
        } yield (foo.name, foo.bar)
    } toMap
Run Code Online (Sandbox Code Playgroud)

但后来我假设地图不会被排序,我需要一个明确的toMap调用.

我怎样才能做到这一点?

scala scala-2.8 scala-collections

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

C#中的分工问题

如何检查204/5是否大于200/5?我尝试使用浮点和十进制数学时遇到了困难.

c#

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

有没有可移植的gcc的__attribute __(纯)?

我正在编写一些代码,其中有许多简单的纯函数可以被调用很多.如果这些函数得到优化以便不经常调用,那么这是非常安全的.

目前我使用gcc作为我的编译器,我想知道是否有一种可移植的方式:

int foo(int) __attribute__ ((pure))
Run Code Online (Sandbox Code Playgroud)

有关纯关键字的信息可以在这里找到:http: //www.ohse.de/uwe/articles/gcc-attributes.html#func-pure

如果pure关键字不可用,我将如何实现类似的东西呢?

c++ portability gcc

10
推荐指数
3
解决办法
1168
查看次数

Wget整个受密码保护的http目录

我正在尝试使用wget备份我的一个受密码保护的网站.我似乎无法正确格式化命令,因为我不断收到401错误:

wget http://dev.example.com/"Login?mode=login
> &user-username=TYPEUSERNAMEHERE&user-password=TYPEPASSWORDHERE"
Run Code Online (Sandbox Code Playgroud)

谁能告诉我这里做错了什么?使用wget下载受密码保护的整个目录的正确方法是什么?谢谢!

ssh wget

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

在Uicolor中背后的逻辑是255

我们通常在UIColorsetcolor RGB争论中写入143.0/255.0.任何人都可以告诉我Divide by 255.0背后的逻辑.我有一些知识,但我猜它是不完整的.

iphone uicolor ios

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

C struct中的c ++字符串,是非法的吗?

struct run_male_walker_struct {
        string male_user_name;
        string show_name;
};
typedef struct run_male_walker_struct run_male_walker_struct_t;
Run Code Online (Sandbox Code Playgroud)

在另一个功能:

run_male_walker_struct_t *p = malloc(sizeof(struct run_male_walker_struct));
Run Code Online (Sandbox Code Playgroud)

问题,这是非法的吗?由于字符串是一个类,因此sizeof()无法确定其大小.

c++

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

函数在Fortran中返回数组

我的理解是你可以从Fortran中的函数返回一个数组,但由于某种原因,我的代码只返回我要求它返回的数组中的第一个值.这是功能:

function polynomialMult(npts,x,y)
    integer npts
    double precision x(npts), results(npts + 1), y(npts,npts)

    polynomialMult =  x(1:npts) + 1

end function
Run Code Online (Sandbox Code Playgroud)

这就是我所说的

 C(1:numPoints) = polynomialMult(numPoints,x,f)

print *, C(1:numPoints)`
Run Code Online (Sandbox Code Playgroud)

现在它没有做任何有用的事情,因为我在编写逻辑之前试图理解语法.我看到了一些关于为函数指定类型的东西,但是当我写的时候

integer function polynomialMult(npts,x,y)
Run Code Online (Sandbox Code Playgroud)

或者无论我得到编译错误.

arrays fortran function fortran90

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

在C#.NET中查看docx文件

我需要创建C#.NET解决方案直接从数据库查看.docx文件,而无需在硬盘上写入.什么是最可行的方法?

一种选择是将docx文件转换为.mht格式,并将其作为blob类型保存在数据库中.但我找不到从数据库中直接查看它的方法.

另一种方法是将docx文件转换为.jpg文件,可以使用.NET中的图片框控件直接从数据库中查看.采取的方法是首先将docx转换为.mdi,然后转换为.tiff格式(使用Microsoft Image Writer)并转换为jpeg.但这涉及多个IO操作,这降低了解决方案的效率和可靠性.

如果有人知道如何改进上述选项或任何新想法,我们将非常感激.提前致谢 :)

.net c# blob docx mhtml

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

如何在SQLite中的insert查询中返回自动增量值?

在我的项目中,我使用System.Data.SQLite.数据库有表Tags,其中包含自动增量主要字段ID(类型Integer).我写的时候:

using (SQLiteCommand command = conn.CreateCommand())
{
   command.CommandText = "insert into Tags(name) values(@name) returning into @id";
   command.Parameters.Add("@id", DbType.Int32).Direction = ParameterDirection.Output;
   command.ExecuteNonQuery();
}
Run Code Online (Sandbox Code Playgroud)

Visual Studio表示不支持该操作.怎么解决?

在线发生错误:

command.Parameters.Add("@id", DbType.Int32).Direction = ParameterDirection.Output;
Run Code Online (Sandbox Code Playgroud)

c# sqlite auto-increment

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