问题列表 - 第43942页

通过maven-antrun-plugin使用antcontrib <if>任务

我的maven java项目使用maven-antrun-plugin来执行部署我的应用程序的deploy.xml ant脚本.deploy.xml使用该<if>任务,这似乎导致了问题;

[INFO]执行任务
[taskdef]无法从资源net/sf/antcontrib/antlib.xml加载定义.它无法找到.

部署:
[INFO] --------------------------------------------- ---------------------------
[ERROR] BUILD ERROR
[INFO] --------------- -------------------------------------------------- -------
[INFO]发生了Ant BuildException:执行此行时发生以下错误:
E:\ My_Workspace\xxxxxx\xxxxxx\xxxxxxx\deploy.xml:24:问题:创建任务或类型失败如果
原因:名称未定义.
行动:检查拼写.
操作:检查是否已声明任何自定义任务/类型.
操作:检查是否已发生任何<presetdef>/<macrodef>声明.

这是我的pom的antrun插件配置;

<plugin>
    <inherited>false</inherited>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>remote-deploy</id>
            <phase>install</phase>
            <configuration>
                <tasks>
                    <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath"/>

                        <property name="compile_classpath" refid="maven.compile.classpath" />
                        <property name="runtime_classpath" refid="maven.runtime.classpath" />
                        <property name="plugin_classpath" refid="maven.plugin.classpath" />

                        <echo message="compile classpath: ${compile_classpath}"/>
                        <echo message="runtime classpath: ${runtime_classpath}"/>
                        <echo message="plugin classpath: ${plugin_classpath}"/>

                        <ant antfile="${basedir}/deploy.xml">
                            <target name="deploy" />
                        </ant>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>ant-contrib</groupId> …
Run Code Online (Sandbox Code Playgroud)

java ant-contrib maven maven-antrun-plugin

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

"致命错误:在不在对象上下文中时使用$ this"但在对象上下文中使用代码IS

我得到了旧的熟悉的"致命错误:在不在对象上下文中时使用$ this" $this->test = 'test';在下面的类中引用:

class Example {
    public $test;
    public function index() {
        $this->test = 'test';
    }
}
Run Code Online (Sandbox Code Playgroud)

类方法通过调用call_user_func_array(array('example', 'index'), $params);.我只能假设call_user_func_array由于某种原因决定将索引方法称为静态例如example::index()?但是我还没有想到解决这个问题,奇怪的是我直到最近才遇到问题.

php oop

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

在枚举中使用DateTime对象

我有这个枚举:

public enum TimePeriod
{
    Day = DateTime.Now.AddDays(-1),
    Week = DateTime.Now.AddDays(-7),
    Month = DateTime.Now.AddMonths(-1),
    AllTime = DateTime.Now
}
Run Code Online (Sandbox Code Playgroud)

但是不能这样做

(DateTime)timePeriod
Run Code Online (Sandbox Code Playgroud)

如何获得枚举日期?

c# enums

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

Android - 根据设备分辨率调整图库中的图像大小

我有一个Android应用程序从Web上提取图像.但是,当我设置:

<supports-screens android:anyDensity="true" />
Run Code Online (Sandbox Code Playgroud)

图库似乎设置为支持的最低分辨率.

这是画廊布局定义:

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout android:id="@+id/GalleryLayout"
              android:layout_width="fill_parent" 
              android:layout_height="fill_parent"
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:background="#000000"
              >

<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/gallery"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:spacing="1dip"
         android:gravity="center_vertical|center_horizontal|center"
/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

和getView类:

ImageView i = new ImageView(mContext);
i.setImageDrawable(drawablesFromUrl[position]);
i.setLayoutParams(new Gallery.LayoutParams(400, 300));
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(mGalleryItemBackground);
Run Code Online (Sandbox Code Playgroud)

有没有办法检测使用的分辨率,然后调整图库中的图像大小,以便它们延伸到屏幕的宽度?

android resolution image gallery

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

如何在c#/ .net中对List <T>进行排序

我有一节课PropertyDetails:

public class PropertyDetails
{

     public int Sequence { get; set; }

     public int Length { get; set; }

     public string Type { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我正在创建一个PropertyDetailsas 列表

List<PropertyDetails> propertyDetailsList=new List<PropertyDetails>();
Run Code Online (Sandbox Code Playgroud)

我想按此排序PropertyDetails.Sequence.

Linq解决方案是受欢迎的.

c# sorting list

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

使用Capybara测试多域Rails 3应用程序

我想测试我的多域RoR3应用程序.

这是我的test_helper.rb

ENV["RAILS_ENV"] = "test"

require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'capybara/rails'
require 'blueprints'

class ActiveSupport::TestCase

end

class ActionDispatch::IntegrationTest
  include Capybara

  def host
    "http://#{subdomain}.lvh.me:3000"
  end

  def subdomain
    @subdomain ? @subdomain : 'demostore'
  end

  def visit(url)
    super("http://#{subdomain}.lvh.me:3000#{url}")
  end
end
Run Code Online (Sandbox Code Playgroud)

我的集成测试:

require 'test_helper'

class ProductsTest < ActionDispatch::IntegrationTest

  def setup
    @subdomain = 'demostore'
    # creating stuff
  end

  def teardown
    # deleting stuff
  end

  test "user views product list" do
    visit('/')
    assert page.has_css?('ul.product-listing')
    assert page.has_xpath?("//ul[@class='product-listing']/li", :count => 12)
  end

  test "user views product page" …
Run Code Online (Sandbox Code Playgroud)

integration-testing ruby-on-rails capybara

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

如何保持jquery移动页眉和页脚固定?

我正在使用jQuery Mobile创建一个网站.

如何保持jquery移动页眉和页脚固定?我只想要内容滚动(就像它在iPhone应用程序中发生的那样),并保持页眉和页脚固定在顶部和底部.

有什么建议 ?

mobile jquery

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

检查单词是否包含Java Regex中的子字符串

如果我想检查包含子字符串DEF的所有单词,这是否是正确的方法:

^.*[D][E][F].*$
Run Code Online (Sandbox Code Playgroud)

在否定正则表达式时也有一个简单的规则,即修改上述内容以识别不包含DEF的字符串

编辑:我知道这不需要正则表达式,但为了我的目的它.

java regex string

14
推荐指数
2
解决办法
7万
查看次数

虚函数的C++问题

我需要用C++编写一些东西.我有虚拟功能的问题.

例如,在头文件中Human.h我有这个:

class Human
{
    public:
        virtual int Age();
        Human();
        ~Human();
}
Run Code Online (Sandbox Code Playgroud)

Human.cpp文件中我有这个:

#include<iostream>
#include "Human.h"

int Human::Age()
{
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我得到这些编译错误:

Error    4    error C2371: 'Human::Age' : redefinition; different basic types    c:\users\jan\desktop\testc\testc\human.cpp    5    1    TestC
Error    3    error C2556: 'Human Human::Age(void)' : overloaded function differs only by return type from 'int Human::Age(void)'    c:\users\jan\desktop\testc\testc\human.cpp    5    1    TestC
Error    2    error C2628: 'Human' followed by 'int' is illegal (did you forget a ';'?)    c:\users\jan\desktop\testc\testc\human.cpp    4    1 …
Run Code Online (Sandbox Code Playgroud)

c++ virtual function

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

寻找具有良好单元测试覆盖率的开源Delphi项目

出于教育原因,我正在寻找一个具有良好单元测试覆盖率的开源Delphi项目.优先考虑受测试驱动开发的项目.项目的规模无关紧要.

主题应该是商业或游戏开发,但不是网络项目.

任何提示?

编辑:

感谢您的建议,但我更喜欢那些请求来自"普通"用户而不是来自CRM或ERP系统等程序员的项目.例如,任务计划程序或跳转运行游戏.有没有人见过这样的东西?

delphi tdd unit-testing

15
推荐指数
2
解决办法
945
查看次数