问题列表 - 第32858页

Text Area helper,如何设置maxlength

文本区域助手,我如何将字符串的最大长度设置为100.
在ROR中的文本区域助手中是否有任何最大长度属性.

代码会帮助我.谢谢

html ruby textarea ruby-on-rails

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

带有数组数据的jqgrid中的分页问题

我在jqgrid中遇到了具有18条记录的数组数据的分页问题,​​但是即使我指定了分页,记录也没有显示在页面中:true,pager:jQuery('#pager1').你能帮我实现分页而不是滚动.

<script type="text/javascript">
 jQuery("#list4").jqGrid({
 datatype: "clientSide",
 height: 200,
    colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
    colModel:[
    {name:'id',index:'id', width:60, sorttype:"int"},
    {name:'invdate',index:'invdate', width:90, sorttype:"date"},
    {name:'name',index:'name', width:100},
    {name:'amount',index:'amount', width:80, align:"right",sorttype:"float"},
    {name:'tax',index:'tax', width:80, align:"right",sorttype:"float"},
    {name:'total',index:'total', width:80,align:"right",sorttype:"float"},
    {name:'note',index:'note', width:150, sortable:false}
    ],
    multiselect: true,
 pagination:true,
  pager:jQuery('#pager1'), 
 rowNum: 10,
 rowList: [5, 10, 20, 50],
 sortname: 'id',   
 sortorder: 'asc',
 viewrecords: true,
 page: 1,
 loadonce: true,  
 totalpages: 2,   
 totalrecords:18,     
 showpage:true,   
 imgpath: "/themes/default/images",         
 caption: "Manipulating Array Data"
 });
 var mydata = [
 {id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
 {id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},
 {id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},
 {id:"4",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
 {id:"5",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},
 {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},
 {id:"7",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
 {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},
 {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},
 {id:"10",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
 {id:"11",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery pagination json jqgrid

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

如何在JSF 2.0中获取选项卡式窗格组件(Sun Mojarra)

我现在正在学习/使用JSF 2.0(Sun Mojarra),我希望在我的webapp中有一个选项卡式窗格(单个选项卡可以命名为General,Detail1,Detail2,...).

我该如何实现这一目标?到目前为止,我还没有找到任何纪录片:(

java jsf tabs tabbed-interface jsf-2

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

对象持久性术语:'存储库'与'存储'对比'上下文'与'检索者'对比(...)

我不确定在设计程序的数据访问层(DAL)时如何命名数据存储类.

(通过数据存储类,我的意思是一个类,负责将持久化对象读入内存,或者持久保存内存中对象.)

根据两件事命名数据存储类似乎是合理的:

  • 它处理的物品类型;
  • 是否加载和/或持久存在此类对象.

Banana可以调用加载对象的类,例如BananaSource.

我不知道如何处理第二点(即Source示例中的位).我见过不同的名词显然是出于这个目的使用的:

  • 存储库:听起来很一般.这是否表示可读/写可访问的内容?
  • store:这听起来像是可能允许写访问的东西.
  • 上下文:听起来非常抽象.我用LINQ和对象关系映射器(ORM)看过这个.
    PS(几个月后):这可能适用于包含"活动"或其他监督对象的容器(工作单元模式会浮现在脑海中).
  • 猎犬:听起来像只读的东西.
  • source&sink:可能不适合对象持久性; 更适合数据流?
  • 读者/作者:其意图非常清楚,但听起来对我来说太技术了.

这些名称是否是任意的,或者每个名称背后是否有广泛接受的含义/语义差异?更具体地说,我想知道:

  • 只读数据存储的名称是什么?
  • 什么名称适用于只写数据存储?
  • 对于偶尔更新的大多数只读数据存储,哪些名称适合?
  • 对于偶尔读取的大多数只写数据存储,哪些名称适合?
  • 一个名字是否同样适合所有场景?

persistence datasource terminology data-access-layer naming-conventions

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

如何引用具有相同名称的不同程序集?

我有 2 个不同的同名程序集需要添加到我的项目中。

当我尝试将两个引用添加到项目时,visual studio 告诉我该程序集已被引用(因为已经有一个同名的程序集)。

我尝试重命名其中一个文件。我可以添加两个引用,但是当从重命名的程序集中访问方法时,解析失败(因为 .net 尝试使用原始名称加载程序集)。

注意:程序集不是我的,因此我无法更改它们的内容。

.net visual-studio-2008

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

如何在ActiveRecord类方法中使用'map'方法?

我不确定我的Ruby语法.

我想定义一个我可以这样调用的方法:client.invoices.average_turnaround.所以我的average_turnaround方法需要使用一组ActiveRecord对象.

到目前为止,这是我的代码:

class Invoice < ActiveRecord::Base
  ...
  def self.average_turnaround
    return self.map(&:turnaround).inject(:+) / self.count
  end
end
Run Code Online (Sandbox Code Playgroud)

所以我试图找出每张发票的周转时间总和,然后除以发票总数.

Ruby抱怨没有map定义方法Class.我原以为self是一个Array.

如何编写一个适用于该集合Invoices并使用该map函数的方法?我哪里错了?

ruby collections activerecord ruby-on-rails map

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

dllimport静态数据成员的C++定义

我有一个类如下所示:

//.h file
class __declspec(dllimport) MyClass
{
    public:
    //stuff
    private:

    static int myInt;
};

// .cpp file
int MyClass::myInt = 0;
Run Code Online (Sandbox Code Playgroud)

我得到以下编译错误:

error C2491: 'MyClass::myInt' : definition of dllimport static data member not allowed
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

c++ dll static static-members

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

ProgressDialog中的进度单位

Android的ProgressDialog允许您将当前进度和最大值设置为整数.这些值在对话框中显示如下:

一万〇二十三分之三千四百〇一

第一个数字是当前进度,第二个数字是最大值.

我还想展示测量单位.像这样的东西:

3401/10023 KB

这可能使用ProgressDialog吗?如果没有,您建议您将此信息提供给用户?我试图避免重新实现ProgressDialog以包含该单元.

android progressdialog

9
推荐指数
3
解决办法
7328
查看次数

覆盖忽略属性

Content of Build.xml File


<?xml version="1.0"?>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="ant-contrib-0.6.jar"/>
<taskdef classpath="orangevolt-ant-tasks-1.3.2.jar" resource="com/orangevolt/tools/ant/taskdefs.properties"/>               
<project name="initinstaller" default="all" basedir="." >       
<target name="configure-server-types-module">       
    <property file="./installation.conf"/>  
    <echo message="${client.server.types}"/>
    <if>
        <not>               
            <contains string="${client.server.types}" substring="tomcat" />
        </not>
    <then>
        <replaceregexp file="./installation.conf"
                match="client.server.types=(.*)" 
                replace="client.server.types=\1tomcat,"
                byline="true">
        </replaceregexp>
    </then>
    </if>       
</target>

<target name="all" depends="configure-server-types-module">     
    <property file="./installation.conf"/>  
    <echo message="${client.server.types}"/>
    <if>
        <not>               
            <contains string="${client.server.types}" substring="tomcat" />
        </not>
    <then>
        <replaceregexp file="./installation.conf"
                match="client.server.types=(.*)" 
                replace="client.server.types=\1tomcat,"
                byline="true">
        </replaceregexp>
    </then>
    </if>       
</target>
Run Code Online (Sandbox Code Playgroud)

Content of installation.conf : client.server.types=jboss,
Run Code Online (Sandbox Code Playgroud)

详细输出:

Apache Ant version 1.8.1 compiled on April 30 2010
Trying …
Run Code Online (Sandbox Code Playgroud)

ant

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

为什么人们说javascript eval()是邪恶的,但你对setTimeout和setInterval等没有异议?

如果我没有弄错,eval会在给定的字符串中执行有效的代码

eval("alert('hey')");
Run Code Online (Sandbox Code Playgroud)

setTimeout("alert('hey')",1000);
Run Code Online (Sandbox Code Playgroud)

做同样的事情,只有一个计时器.设置超时和eval一样有风险吗?

javascript eval settimeout setinterval

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