我在Linux 2.6.我有一个环境,其中2个进程通过简单的消息传递模式实现模拟(使用共享内存)数据交换.
我有一个客户端进程(从父服务器分叉,它是服务器),它将结构(消息)写入创建的内存映射区域(在fork之后):
message *m = mmap(NULL, sizeof(message), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0)
然后,该指针被写入到队列(在链接列表的形式)转换成是共同的服务器和客户端处理(因为如果事先创建上面相同的代码叉)另一个共享存储器区域.然后由服务器读取该区域,该服务器获得指向消息的指针并对其进行处理.
问题是*m是在fork()之后创建的,当服务器进程尝试访问指向的内存位置时,我得到了分段错误.在客户端创建后,是否可以将该内存区域附加到服务器POST分叉?
注意:我不想在分叉之前将指针映射到消息(然后在服务器之前共享它)因为我通常不知道客户端想要发送到服务器的消息数量,而且可能还有更多消息比一个客户端进程,所以我想只在客户端需要发送消息时创建一个新的共享内存块,并在服务器收到该消息后取消映射.
注意:这是出于学术目的:我知道这不是解决这个问题的最佳方法,但我只需要遵循这条道路.
提前致谢!
这是我的问题:我有不同的实体链接到其他人,直到嵌套深度为3.我在每个对象中的所有外来字段都注明了
@DatabaseField(foreign = true, foreignAutoRefresh = true)
Run Code Online (Sandbox Code Playgroud)
但是只有嵌套深度为2才能获得实际的autoRefreshed异物.
例如,如果我查询A实体然后我这样做:
A.getB().getC().getD()
Run Code Online (Sandbox Code Playgroud)
对于实体B和CI已经具有所有字段,而对于实体DI仅具有获取的ID,并且我需要调用dao.refresh()方法以获取所有D字段.这是一个限制吗?我在文档上找不到任何相关内容.
如何在ORMLite中构建一个查询,以便我可以使用orderBy函数(使用带有原始字符串或参数化函数的函数)引用与我正在构建查询的dao不同的实体的属性. ?我的查询是这样构建的:
// Inner query for performances
QueryBuilder<Performance, String> performancesQB = performanceDao.queryBuilder();
performancesQB.selectColumns("performance_id");
SelectArg performanceSelectArg = new SelectArg();
performancesQB.where().lt("date", performanceSelectArg);
// Outer query for Order objects, where the id matches in the performance_id
// from the inner query
QueryBuilder<Order, String> ordersQB = orderDao.queryBuilder();
ordersQB.where().isNull("user_id").and().in("performance_id", performancesQB);
ordersQB.orderByRaw("performances.date DESC");
pastOrdersQuery = ordersQB.prepare();
Run Code Online (Sandbox Code Playgroud)
每当我尝试执行此查询时,我得到的异常是:
android.database.sqlite.SQLiteException: no such column: performances.date:,
while compiling: SELECT * FROM `orders` WHERE
(`user_id` IS NULL AND `performance_id` IN
(SELECT `performance_id` FROM `performances` WHERE `date` < ? ) )
ORDER …Run Code Online (Sandbox Code Playgroud) 我目前在一个运行Apache网络服务器的远程CentOS 5.6系统上运行ssh.我需要使用poppler pdftohtml二进制文件,遗憾的是,该二进制文件当前未安装在该计算机上.所以我下载了poppler包并在我的用户文件夹下构建它.由于我不是系统管理员,我没有做
make install
Run Code Online (Sandbox Code Playgroud)
我的所有编译文件都在
/users/myfolder/poppler-0.18.2/
Run Code Online (Sandbox Code Playgroud)
我需要通过php执行的文件shell_exec()是
/users/myfolder/poppler-0.18.2/utils/pdftohtml
Run Code Online (Sandbox Code Playgroud)
如果我通过ssh bash执行它,我会得到正确的输出.相反,如果我把这一行放在php脚本上:
echo shell_exec("/users/myfolder/poppler-0.18.2/utils/pdftohtml");
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
sh: /users/myfolder/poppler-0.18.2/utils/pdftohtml: Permission denied
Run Code Online (Sandbox Code Playgroud)
我尝试设置为777文件权限,目前是-rwxrwxrwx.我也注意到使用shell_exec("whoami");"apache"结果.如果文件权限是-rwxrwxrwx,apache是否应该能够执行脚本?
我也知道安装poppler make install会解决问题,但由于这是出于测试目的,我想避免在我的个人文件夹外"污染"系统,直到测试完成.
感谢任何有帮助的人!
android ×2
foreign-keys ×2
java ×2
ormlite ×2
c ×1
ipc ×1
linux ×1
mmap ×1
pdf-to-html ×1
permissions ×1
php ×1
poppler ×1
shell-exec ×1
sql-order-by ×1