小编Tar*_*lli的帖子

JSON模式到Javascript类型的对象

是否有任何库可以从JSON模式生成Javascript类型的对象(JS函数)?基本上是这个http://code.google.com/p/jsonschema2pojo/的等效JS版本.谢谢.

编辑:

从...开始 :

{
    "description": "An entity",
    "type":"object",
    "properties": {
        "geometries": {"type": "array",
            "items": {
                "$ref" : "geometry"
             }
          }
    }
}
Run Code Online (Sandbox Code Playgroud)

我想为我生成一些像这样的代码

function Entity {
    this.geometries;
}
Run Code Online (Sandbox Code Playgroud)

显然,使用$ ref等模式可能会更复杂.我希望这会给出这个想法.

javascript json code-generation

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

在没有Node.js的javascript中使用lz4压缩

我试图让LZ4解压缩在纯JavaScript的客户端工作.

我找到了这个JavaScript库,但它意味着与Node.js一起使用.在同一个存储库中,我找到了一个理论上可以在浏览器中使用的.问题是这样的库仍然需要Node.js缓冲区,因为我没有使用Node.js,所以我没有这个缓冲区,所有这些都发生在客户端(我在这里记录了一个错误,试图抓住一些关于如何使用它的指针).

然后我找了一个Node.js缓冲区的移植,我找到了这个存储库.问题是,当我使用它时,我在Chrome和Firefox中都会遇到此错误:

TypeError: this is not a typed array

我为此记录了此错误报告.我觉得要把这两个库结合起来,我不会在纯JavaScript中实现lz4解压缩,但以前从未使用过ArrayBuffer,Uint8Array和Node.js,我正在努力连接点.

我的问题:有没有人成功设法用纯JavaScript解压缩LZ4?有什么建议或指示?提前致谢.

javascript compression node.js lz4

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

Eclipse Virgo在EC2上无缘无故关机

我有一个干净安装Eclipse Virgo(3.5)的问题,一旦它在Amazon EC2上的Ubuntu映像12.04上启动,显然无缘无故地关闭.我从SSH开始处女座,启动工作正常但几个小时后服务器停止,日志报告如下(见第三行):

[2012-12-10 11:57:14.804] INFO  http-bio-8080-exec-9         org.springframework.web.servlet.handler.SimpleUrlHandlerMapping   Mapped URL path [/splash] onto handler 'splashController' 
[2012-12-10 11:57:14.840] INFO  http-bio-8080-exec-9         org.springframework.web.servlet.DispatcherServlet                 FrameworkServlet 'splash': initialization completed in 92 ms 
[2012-12-10 15:33:27.488] INFO  System Bundle Shutdown       o.e.g.b.extender.internal.activator.ContextLoaderListener         Stopping [org.eclipse.gemini.blueprint.extender] bundle v.[1.0.0.RELEASE] 
[2012-12-10 15:33:27.493] INFO  kernel-dm-10                 o.e.g.blueprint.context.support.OsgiBundleXmlApplicationContext   Unpublishing application context OSGi service for bundle Virgo Kernel Admin
 Shell (org.eclipse.virgo.kernel.shell) 
[2012-12-10 15:33:27.494] INFO  kernel-dm-10                 o.e.g.blueprint.context.support.OsgiBundleXmlApplicationContext   Closing OsgiBundleXmlApplicationContext(bundle=org.eclipse.virgo.kernel.she
ll, config=osgibundle:/META-INF/spring/*.xml): startup date [Mon Dec 10 11:40:04 UTC 2012]; root of context hierarchy 
[2012-12-10 15:33:27.495] INFO  kernel-dm-10 …
Run Code Online (Sandbox Code Playgroud)

ssh tomcat osgi amazon-ec2 eclipse-virgo

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

jqgrid中子网格的postData不起作用?

嗨我有一个带有子网格的jqgrid,它调用了一个servlet.我正在使用POST向servlet发送一些数据,但是在调用子网格时不会发送相同的数据.这是我的JS:

$("#testsTable").jqGrid({
  mtype: "POST",
  url: "GetCurrentStatusServlet",
  postData: {buildPath :"C:\\Test\\01"},
  datatype: "xml",
     colNames:['TestCase Name', 'Last Update', 'Status'],
     colModel:[
      {name:'name',index:'name', width:90},
      {name:'lastupdate',index:'lastupdate', width:100},
      {name:'status',index:'status', width:80, align:"right"}   
     ],
     rowNum:10,
     autowidth: true,
     rowList:[10,20,30],
     pager: $('#pager1'),
     sortname: 'id',
     viewrecords: true,
     multiselect: true,
  caption: "Tests",
     sortorder: "desc",
     subGrid: true,
     subGridUrl : "GetCurrentStatusServlet",
     subGridModel: [ {
       name:  ['TestCase Name', 'Last Update', 'Status'],
       width : [100, 200, 80],
       params: ['name']}]
 }).navGrid('#pager1',{edit:false,add:false,del:false}); 
Run Code Online (Sandbox Code Playgroud)

那么我怎样才能将postData也发送到子网格servlet?有没有办法指定subgridPostData?谢谢.

jquery jqgrid subgrid

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