小编tri*_*ner的帖子

Java:忽略转义序列

对于我的命令行界面,在开头有一个小的ASCII艺术通常很好,但那些通常包含许多反斜杠.

例如:

System.out.println("  _____ _______       _____ _  __ ");
System.out.println(" / ____|__   __|/\   / ____| |/ / ");
System.out.println("| (___    | |  /  \ | |    | ' /  ");
System.out.println(" \___ \   | | / /\ \| |    |  <   ");
System.out.println(" ____) |  | |/ ____ \ |____| . \  ");
System.out.println("|_____/   |_/_/    \_\_____|_|\_\ ");
Run Code Online (Sandbox Code Playgroud)

但由于每个"\"需要一个"\\"这往往代码看起来很丑陋,它是很难找到/在"字体"修正错误.有没有办法告诉Java NOT使用转义序列?

java escaping backslash ascii-art

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

CDI Weld忽略排除

我正在使用Weld SE在我的应用程序中使用CDI.由于某些库可能具有@Inject注释,并且不希望让Weld扫描所有库.因此,我想在beans.xml中排除某些包前缀:

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
       http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
    <scan>
        <exclude name="com.**" />
        <exclude name="org.**" />
        <exclude name="io.**" />
        <exclude name="groovy.**" />
    </scan>
</beans>
Run Code Online (Sandbox Code Playgroud)

但在执行时我收到以下错误:

2014-05-26T17:02:49.855 - INFO  - Version                        - WELD-000900: SNAPSHOT
2014-05-26T17:02:50.340 - WARN  - Bootstrap                      - WELD-001208: Error when validating jar:file:/home/trichner/uepaa/uepaa-net/cloud/target/unet-cloud-0.1-SNAPSHOT-jar-with-dependencies.jar!/META-INF/jboss-beans.xml@19 against xsd. cvc-elt.1: Cannot find the declaration of element 'deployment'.
2014-05-26T17:02:50.408 - INFO  - Bootstrap                      - WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
2014-05-26T17:02:50.477 - WARN …
Run Code Online (Sandbox Code Playgroud)

java maven cdi weld

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

Android通知灯无效

我正在使用通知让用户现在该服务仍在运行.现在我想使用notificationlight来提醒用户.(因为它很花哨)

通知工作正常,但通知灯什么都不做.其他应用程序与通知灯工作正常,(gtalk,脸书)

它或多或少是添加这些标志的通知的示例代码:

notification.ledARGB = 0xff00ff00;
notification.ledOnMS = 100;
notification.ledOffMS = 100;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;

notification.flags |= Notification.FLAG_NO_CLEAR + Notification.FLAG_ONGOING_EVENT;
mNotificationManager.notify(NOTIFICATION_ID, notification);
Run Code Online (Sandbox Code Playgroud)

notification.defaults |= Notification.DEFAULT_LIGHTS;
Run Code Online (Sandbox Code Playgroud)

相反也不起作用.

我正在使用Android 4.0在Galaxy Nexus上进行调试,但应用程序的目标是Android 2.3.3

编辑:这可能是一个许可问题?如果是的话,哪一个?我查看了所有内容,发现通知灯没有匹配权限.

android android-notifications

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