小编RRT*_*RTW的帖子

每个APP的android统计3g流量,怎么样?

对于每个APP的统计网络流量,我现在使用的是Android TrafficStats

我可以获得如下结果:

  • Youtube 50.30 MBytes
  • Facebook 21.39 MBytes
  • Google Play 103.38 MBytes
  • (和更多...)

据我所知,"Android Trafficstats"只是一个指向ac文件的本机指针.(也许是.so?)

但它混合了Wifi和3g流量,有没有办法只获得非WiFi流量统计?

android traffic network-traffic traffic-measurement 3g

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

Struts2没有为与上下文路径[/ Struts2Test]关联的名称空间[/]和操作名称[login]映射的操作

我是Struts2的初学者,我知道这个问题在这里被问过很多次,但是我试图解决这个问题并在这里阅读了很多线程,花了6个小时仍无法正常工作。确实需要更多建议...

这是我的包裹

Struts2Test
  +Struts2Test/src
    +tw.com.rrstudio.java.test
      -TestAction.java
  +Struts2Test/build
  +Struts2Test/WebContent
    +Struts2Test/WebContent/META-INF
      +Struts2Test/WebContent/WEB-INF/classes
      +Struts2Test/WebContent/WEB-INF/lib
      -Struts2Test/WebContent/WEB-INF/spring-context.xml
      -Struts2Test/WebContent/WEB-INF/spring-mvc.xml
      -Struts2Test/WebContent/WEB-INF/struts.xml
      -Struts2Test/WebContent/WEB-INF/struts2-action.xml
      -Struts2Test/WebContent/WEB-INF/web.xml
    -Struts2Test/WebContent/error.jsp
    -Struts2Test/WebContent/index.jsp
    -Struts2Test/WebContent/TestAction.jsp
Run Code Online (Sandbox Code Playgroud)

我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>Struts2Test</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      /WEB-INF/spring-context.xml
      /WEB-INF/spring-mvc.xml
    </param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    <init-param>
      <param-name>actionPackages</param-name>
      <param-value>tw.com.rrstudio.java.test</param-value>
    </init-param>
  </filter>

  <jsp-config>
    <taglib>
      <taglib-uri>HTTP://java.sun.com/jsp/jstl/core</taglib-uri>
      <taglib-location>/WEB-INF/lib/tld/c.tld</taglib-location>
    </taglib>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
  </jsp-config>

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/spring-mvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <session-config>
    <session-timeout>10</session-timeout> …
Run Code Online (Sandbox Code Playgroud)

configuration jsp action namespaces struts2

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

Oracle nvl2 在存储过程 PLS-00201 中不起作用:必须声明标识符“NVL2”

作为标题,我正在写一些关于 Oracle 的存储过程,首先我检查了版本

SELECT * FROM v$version;
Run Code Online (Sandbox Code Playgroud)

结果

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0  Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Run Code Online (Sandbox Code Playgroud)

...

并且,使用常规 SQL 查询尝试了 NVL2

select 'Test: ' || nvl2('...', 'things', 'nothing') from dual;
select 'Test: ' || nvl2('', 'things', 'nothing') from dual;
Run Code Online (Sandbox Code Playgroud)

结果似乎是正确的

Test: things
Test: nothing
Run Code Online (Sandbox Code Playgroud)

...

所以我确认 11g 确实支持 NLV2 功能,我现在可以开始编写我的存储过程,如下所示:

create or replace procedure my_schema.SP_READ_MEMBER(noP in varchar2, nameP …
Run Code Online (Sandbox Code Playgroud)

oracle stored-procedures nvl pls-00201

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

Calendar.getInstance提供错误的日期

我创建了几个小方法作为Util类,如下面的代码:

public class Util
{
  public static final String DATETIME_PATTERN="YYYY/MM/DD - HH:mm:ss";

  public static String getDateTime()
  {
    SimpleDateFormat sdf=new SimpleDateFormat(DATETIME_PATTERN);
    return sdf.format(getToday());
  }

  public static Date getToday()
  {
    //Calendar today=Calendar.getInstance(); //didn't help
    Calendar today=Calendar.getInstance(Locale.TAIWAN); //didn't fix
    //Calendar today=Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00")); //didn't fix as well
    return today.getTime();
  }
}
Run Code Online (Sandbox Code Playgroud)

而且,做了一个非常简单的运行,像这样:

//run in main class
System.out.println("Generating sitemap.xml, please wait..."+Util.getDateTime());
Run Code Online (Sandbox Code Playgroud)

结果是一个非常奇怪的日期 - > 2017/07/117

//Console result:
Generating sitemap.xml, please wait...2017/07/187 - 15:27:21
Run Code Online (Sandbox Code Playgroud)

搜索了类似的问题,并尝试了TimeZone,Locale,但没有帮助.有什么建议 ?


顺便说一句,这是我的环境:

  • Windows7 x86
  • JDK 1.8.0.131 x86
  • 蚀氧x86

java calendar date

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