小编tap*_*per的帖子

如何通过REST获取Sakai中的作业内容

在Sakai,我通过url成功获得了Assignemnt : http://xxx/direct/assignment/ASSIGNMENTID.xml. 但是,在这个实体中,没有详细的背景(我的意思是,老师的任务指示).contentReferenceXML中只有一个内容元素.

<contentReference>/assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d</contentReference>
Run Code Online (Sandbox Code Playgroud)

当我按照这个链接时,我得到404错误:

尝试访问不存在的实体(/ assignment/c)的实体URL路径(/ assignment/c/mercury/b0de53c7-09b6-4ba0-964b-cb0a9e5a028d)

我在Sakai实体上尝试了Google for API文档,但事实证明它已经过时了(我的Sakai 2.9.3的演示版本有些网址错误).然后我尝试深入挖掘Sakai的源代码.但是,我发现只有rsmart服务器上的文件:

在其中我发现:

        throw new IllegalArgumentException(
                "Must include context and assignmentId in the path ("
                        + view
                        + "): e.g. /assignment/a/{context}/{assignmentId}");
Run Code Online (Sandbox Code Playgroud)

我尝试在我的服务器上使用此URL来获取详细内容(尤其是教师的指示).还有另一个404错误与上面相同的内容.

最后,我发现/assignment/a/可能是错误的拼写/assignment/annc/{context}/{assignmentId}.所以现在我发了:

http://localhost:8080/direct/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml
Run Code Online (Sandbox Code Playgroud)

弹出另一个错误:

HTTP状态500 - EntityEncodingException:无法处理此路径的格式xml的输出请求(/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml),用于实体的前缀(赋值)(/ assignment/annc) ,请求url(/assignment/annc/mercury/403d28b4-e152-463d-a615-972db97d34d3.xml):实体的内部输出编码失败:/ assignment/annc

关于通过RESTful获取教师指令数据的URL的任何想法?谢谢.


作业的XML数据.

<assignment type='bean' size='29'>
  <access type='bean' size='0'>
  </access>
  <attachments type='collection' size='1'>
    <decoratedattachment type='bean' size='2'>
      <name>LC Circuit (show name).png</name>
      <url>http://localhost:8080/access/content/attachment/mercury/%E4%BD%9C%E4%B8%9A/a11ef34a-0578-433a-ba7e-9c3bad948bf5/1111.png</url>
    </decoratedattachment>
  </attachments>
  <authorLastModified>admin</authorLastModified>
  <authors type='collection' size='0'> …
Run Code Online (Sandbox Code Playgroud)

java rest sakai

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

Tensorflow 的 while 循环在 GPU 上运行缓慢?

由于未知原因,以下代码在 GPU 上比在 CPU 上慢了两倍。谁能解释为什么:

import time
import tensorflow as tf

with tf.device('/device:GPU:0'):  # gpu takes: 5.132448434829712 seconds
    # with tf.device('/cpu:0'): # cpu takes: 3.440524101257324 seconds
    i = tf.constant(0)
    while_condition = lambda i: tf.less(i, 2 ** 20)
    a = tf.fill([16, 16], 1.1)
    b = tf.fill([16, 16], 2.2)
    def body(i):
        res = tf.matmul(a, b)
        # increment i
        add = tf.add(i, 1)

        return (add,)


    ini_matmul = tf.matmul(a, b)

    # do the loop:
    loop = tf.while_loop(while_condition, body, [i])

with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as sess:
    sess.run(ini_matmul) …
Run Code Online (Sandbox Code Playgroud)

tensorflow

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

标签 统计

java ×1

rest ×1

sakai ×1

tensorflow ×1