小编Tho*_*ley的帖子

模式对象与不同语言不匹配

我有以下reg表达式,当用户输入英语时工作正常.但是在使用葡萄牙语字符时总是会失败.

Pattern p = Pattern.compile("^[a-zA-Z]*$");
Matcher matcher = p.matcher(fieldName);

if (!matcher.matches())
{
   ....
}
Run Code Online (Sandbox Code Playgroud)

有没有办法让模式对象识别有效的葡萄牙字符,如ÁÂÃÀÇÉÊÍÓÔÕÚç....?

谢谢

java regex

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

在jquery-ui datapicker中的"今天"按钮上添加事件侦听器

我正在使用datepicker表单jQuery-ui-1.8.16.

我有以下代码:

Site.Calendar = function() {

    // Set default setting for all calendars
    jQuery.datepicker.setDefaults({
        showOn : 'both',
        buttonImageOnly : true,
        buttonText: '',
        changeMonth : true,
        changeYear : true,
        showOtherMonths : true,
        selectOtherMonths : true,
        showButtonPanel : true,
        dateFormat : "D, d M, yy",
        showAnim : "slideDown",
        onSelect: Site.Calendar.customiseTodayButton
    });
};

Site.Calendar.customiseTodayButton = function(dateText, inst) {
    console.log("hello");
};
Run Code Online (Sandbox Code Playgroud)

我的customiseTodayButton函数仅在我选择实际日期时触发,而不是在今日按钮上触发.

有没有办法覆盖今天按钮在jQuery datepicker中的工作方式?

谢谢

jquery-ui jquery-ui-datepicker

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

使用 ReloadableResourceBundleMessageSource 在类路径上动态加载文件

我是 Spring 的新手,正在尝试使用它的 ReloadableResourceBundleMessageSource 类。

我正在尝试使用它,以便我们不再需要重新启动我们的 Web 应用程序来更改/更新属性文件。

我有一个 Web 应用程序(主要使用 JSF)和一个单独的 tar 组件,其中包含我的所有属性文件。

属性tar的结构如下:

 - CompanyOneMessages.properties
 - CompanyOneMessages_fr_FR.properties
 - CompanyTwoMessages.properties
 - CompanyTwoMessages_fr_FR.properties
 - CompanyThreeMessages.properties
 - CompanyThreeMessages_fr_FR.properties
 - ...
Run Code Online (Sandbox Code Playgroud)

此 tar 被解压缩并部署到服务器上的某个位置,该位置指定为位于 websphere 配置中的类路径上。

我将以下内容添加到我的 applicationContext-config.xml 中:

<!-- Enable reloading of resource bundles without requiring web-app restart -->
    <bean id="messages"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basenames">
            <list>  
                <value>classpath:com/resource/dynamic/CompanyOneMessages</value>
                <value>classpath:com/resource/dynamic/CompanyTwoMessages</value>
                <value>classpath:com/resource/dynamic/CompanyThreeMessages</value>              
            </list>
        </property>     
        <property name="cacheSeconds" value="1" />
    </bean>

    <!-- Declare location of bean to handle messages and define property reference 
         we will use to …
Run Code Online (Sandbox Code Playgroud)

java resourcebundle spring-mvc

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

如何在mac上打开多个Spring STS实例

每当我双击STS图标时,它再次打开相同的实例.

如何打开多个实例?

eclipse macos

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

Rails的Rss提要阅读器

我正在寻找创建一个cron作业,它将从多个RSS源收集数据并将信息存储在数据库表中.

我要解析的两个Feed示例:http:
//news.google.com/news?ned = ie&topic = n&output = rss
http://rss.news.yahoo.com/rss/asia

我想知道人们是否有最好的rails gem用来做这个的建议?(不要一开始就找出有限制/错误的一半.)

谢谢

rss ruby-on-rails

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

使用 JSF2 包含上下文根之外的资源

我目前正在将应用程序从 JSF 1.2 和 Richfaces 3.3 升级到 JSF 2 和 Richfaces 4。

我在使用 JSF2 的新h:outputStylesheet组件让我的应用程序包含样式表时遇到问题

这是我的旧代码:

<a4j:loadStyle src="resource:///com/testing/test/html/css/style.xcss" />
Run Code Online (Sandbox Code Playgroud)


这是我的新代码(不起作用):

<h:outputStylesheet library="resource:///com/testing/test/html/css/" name="style.xcss" />
Run Code Online (Sandbox Code Playgroud)


我尝试过各种变体,但没有一个有效。使用 firebugs css 选项卡时,我收到一条消息,提示 RES_NOT_FOUND。

有任何想法吗?

谢谢

richfaces jsf-2

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

Android浏览器键盘在最后一个输入字段焦点上打开/关闭

我在HTC One和Galaxy S5的Chrome浏览器中发现了一些奇怪的行为。我单击输入字段以输入一些数据,然后键盘将打开,然后立即再次关闭。我注意到它仅在页面上最后一个可用的输入字段上发生。

有人遇到过这个问题吗?

它可以在iPhone和桌面浏览器上正常工作。

谢谢

javascript jquery android-browser

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

在DOM中呈现TinyMCE后执行操作

我正在使用TinyMCE 4并将其设置如下:

tinyMCE.init({
            mode : "specific_textareas",
            editor_selector : "basicTinyMCE",
            theme : "modern",
            readonly : false,
            ...});
Run Code Online (Sandbox Code Playgroud)

我希望在DOM中呈现它之后调用一个函数.

我遇到过这个并尝试过:

tinyMCE.init({
                mode : "specific_textareas",
                editor_selector : "basicTinyMCE",
                theme : "modern",
                readonly : false,
                setup : function(ed) {
                  ed.onPostRender.add(function(ed,cm) {
                    console.log('After render: ' + ed.id);
                  });
                }
              });
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

SCRIPT5007: Unable to get property 'add' of undefined or null reference
Run Code Online (Sandbox Code Playgroud)

任何想法,如果这是实现我想要的正确方法?如果是这样,为什么出现错误?

tinymce

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

rails模型中的自定义非db属性未返回到jquery回调

我有以下型号

class Game < ActiveRecord::Base

  # Associations
  belongs_to :black_member,         :class_name => "Member"
  belongs_to :white_member,         :class_name => "Member"
  belongs_to :current_move_member,  :class_name => "Member"
  belongs_to :game_requests, :foreign_key => "game_request_id"

  #Validations
  #attr_accessible :opponent_nickname, :current_member_id

  # Instance methods
  attr_accessor :opponent_nickname, :current_member_id

  def setup
    if self.white_member_id == self.current_member_id
      self.opponent_nickname = "test"
    end
  end

end
Run Code Online (Sandbox Code Playgroud)

我的控制器:

# POST /games/setup.json 
  def setup

    @game = Game.find(params[:id])
    @game.current_member_id = currentmember.id
    @game.setup

    respond_to do |format|
      format.json { render :json => @game }
    end

  end
Run Code Online (Sandbox Code Playgroud)

我的js函数发送和接收ajax请求到控制器:

// Setup all initial game …
Run Code Online (Sandbox Code Playgroud)

jquery activerecord ruby-on-rails ruby-on-rails-3

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

在gsp中将groovy列表输出为逗号分隔的字符串

我的控制器中有以下内容:

render(view: "create", model: [dealInstance: dealInstance, storeName: params.storeName, location: params.location, openEmailClient: true, emailTo: users*.email])
Run Code Online (Sandbox Code Playgroud)

以及我的create.gsp中的以下内容:

$(document).ready(function () {

  <g:if test="${openEmailClient}">              
    <g:set var="subject" value="${g.message(code: 'deal.created.email.subject')}" scope="page" />
    <g:set var="body" value="${g.message(code: 'deal.created.email.body')}" scope="page" />
    window.location.href = "mailto:${emailTo}?subject=${subject}&body=${body}";
  </g:if>
});
Run Code Online (Sandbox Code Playgroud)

这将打开默认电子邮件客户端并填充"收件人"字段.

如何将电子邮件列表转换为逗号分隔的字符串?(这是否正确?大多数电子邮件客户端是否会接受逗号作为电子邮件分隔符?)

即@ a.com,b @ b.com ......

grails groovy gsp

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

Calendar的GregorianCalendar方法将日期设置为前一天

我使用GregorianCalendar方法在抽象Calendar类中遇到了一个奇怪的问题.

出于某种原因,使用"calendar.set"返回前一天的日期.请参阅下面的代码,例如关于它工作正常的地方的评论,以及它出错的地方.

private Date checkDate(Date d, int hour, int minute, int sec, int milliSec)
{
    // Test values for arguments
    d = "Wed Apr 06 00:00:00 BST 2011";
    hour = minute = sec = milliSec = 0;

    Calendar calendar = new GregorianCalendar(sun.util.calendar.ZoneInfo[id="UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]);
    calendar.setTime(d);

    // *** OK *** calendar.getTime() will display correctly here (Wed Apr 06 00:00:00 BST 2011)

    calendar.set(Calendar.HOUR_OF_DAY, hour);
    calendar.set(Calendar.MINUTE, minute);
    calendar.set(Calendar.SECOND, sec);
    calendar.set(Calendar.MILLISECOND, milliSec);

    // *** NOT OK *** calendar.getTime() will display inncorrectly here (Tue Apr 05 01:00:00 …
Run Code Online (Sandbox Code Playgroud)

java calendar gregorian-calendar

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

查找具有特定弹簧安全角色的用户

我有以下内容:

def userInstance=User.findAll("from User u where u.merchant is not null and u.merchant.id = ? and u.authorities.authority.contains('ROLE_MERCHANT')", merchantId)
Run Code Online (Sandbox Code Playgroud)

并得到以下错误:

org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: ( near line 1, column 121 [from com.testing.tests.User u where u.merchant is not null and u.merchant.id = ? and u.authorities.authority.contains('ROLE_MERCHANT')]
    at $Proxy20.createQuery(Unknown Source)
    at testing.admin.UserService.findByMerchantId(UserService.groovy:14)
Run Code Online (Sandbox Code Playgroud)

如何仅返回具有特定角色的用户?

谢谢

grails groovy hibernate hql spring-security

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