I would like to learn Ant. Can anyone recommend some good learning resources about this topic? Any resource is appreciated, from online introductory tutorials to in-depth books.
Thanks for your help!
根据这篇文章,IDEA使用Osmorc来运行OSGi框架.反过来,它使用Pax Runner来启动不同的框架实现.
IDEA 11中的工具链只能运行Apache Felix 3.0.2,但我必须运行4.0.2版本.可能吗?IDEA还有其他OSGi框架发射器吗?
在Typeclassopedia中练习之后,我尝试为Either实现一个Functor实例.我的第一次尝试如下:
instance Functor (Either a) where
  fmap f (Right a) = Right (f a)
  fmap _ left = left
这会引发以下编译时错误:
functor.hs:7:17:
Couldn't match type ‘a1’ with ‘b’
  ‘a1’ is a rigid type variable bound by
       the type signature for
         fmap :: (a1 -> b) -> Either a a1 -> Either a b
       at functor.hs:6:3
  ‘b’ is a rigid type variable bound by
      the type signature for
        fmap :: (a1 -> b) -> Either a a1 -> Either a b
      at …我有以下servlet.
@DeclareRoles("remote-guest")
@RunAs("remote-guest")
public class GuestServlet extends HttpServlet {
    @EJB
    private Test test;
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        test.guest();
    }
}
映射servlet使得只有具有角色的用户guest才能调用它.
<servlet>
    <servlet-name>guest-servlet</servlet-name>
    <servlet-class>test.web.GuestServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>guest-servlet</servlet-name>
    <url-pattern>/guest</url-pattern>
</servlet-mapping>
<security-role>
    <role-name>guest</role-name>
</security-role>
<security-constraint>
    <web-resource-collection>
        <web-resource-name>guest-resources</web-resource-name>
        <url-pattern>/guest</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>guest</role-name>
    </auth-constraint>
</security-constraint>
该TestEJB由以下实现TestBean类.
@Stateless
@DeclareRoles("remote-guest")
public class TestBean implements Test {
    @RolesAllowed("remote-guest")
    public void guest() {
        System.out.println("TestBean.guest()");
    }
}
问题:当我调用GuestServlet使用仅映射到guest角色的用户时,javax.ejb.EJBAccessException尽管@RunAs …
我想知道如何在功能语言中实现面向对象语言中常见的抽象工厂设计模式.特别是,我对Haskell实现很感兴趣.
我尝试使用类型类来实现模式:
class Product p where
  toString :: p -> String
class Factory f where
  createProduct :: Product p => f -> p
data FirstProduct = FirstProduct
data FirstFactory = FirstFactory
instance Product FirstProduct where
  toString _ = "first product"
instance Factory FirstFactory where
  createProduct _ = FirstProduct
编译此代码时,将返回以下错误:
Could not deduce (p ~ FirstProduct)
from the context (Product p)
  bound by the type signature for
             createProduct :: Product p => FirstFactory -> p
  at test.hs:14:3-15
  ‘p’ is a rigid …