我在Java的内部表示中搜索了String,但我有两种看起来可靠但不一致的材料.
一个是:
http://www.codeguru.com/cpp/misc/misc/multi-lingualsupport/article.php/c10451
它说:
Java使用UTF-16作为内部文本表示,并支持对字符串序列化进行非标准的UTF-8修改.
另一个是:
它说:
Tcl也使用与Java相同的修改后的UTF-8 [25]来表示Unicode数据,但对外部数据使用严格的CESU-8.
修改过的UTF-8?还是UTF-16?哪一个是正确的?Java在内存中使用了多少字节?
请让我知道哪一个是正确的以及它使用了多少字节.
为什么在C中返回Py_None之前需要Py_INCREF(Py_None),如下所示?
Py_INCREF(Py_None);
return Py_None;
Run Code Online (Sandbox Code Playgroud)
如果省略Py_INCREF(Py_None),会发生什么?
我犯了一个大错误,我在MySQL中没有'where'子句更新了一个表:'(
它是自动提交的.
有没有办法从它回滚?
使用Kafka客户端Java库,使用日志已经工作了一段时间但是出现以下错误它不再起作用:
2016-07-15 19:37:54.609 INFO 4342 --- [main] o.a.k.c.c.internals.AbstractCoordinator : Marking the coordinator 2147483647 dead.
2016-07-15 19:37:54.933 ERROR 4342 --- [main] o.a.k.c.c.internals.ConsumerCoordinator : Error UNKNOWN_MEMBER_ID occurred while committing offsets for group logstash
2016-07-15 19:37:54.933 WARN 4342 --- [main] o.a.k.c.c.internals.ConsumerCoordinator : Auto offset commit failed: Commit cannot be completed due to group rebalance
2016-07-15 19:37:54.941 ERROR 4342 --- [main] o.a.k.c.c.internals.ConsumerCoordinator : Error UNKNOWN_MEMBER_ID occurred while committing offsets for group logstash
2016-07-15 19:37:54.941 WARN 4342 --- [main] o.a.k.c.c.internals.ConsumerCoordinator : Auto offset commit failed: …Run Code Online (Sandbox Code Playgroud) 在HTML中,script元素具有可选的charset属性.
它的目的是什么?
什么时候有用?
我试图在同一个域对象上使用Spring Data JPA和Spring Data Elasticsearch,但它不起作用.
当我尝试运行一个简单的测试时,我得到以下异常:
org.springframework.data.mapping.PropertyReferenceException:找不到Person类型的属性索引!org.springframework.data.mapping.PropertyPath.(PropertyPath.java:75)〜[spring-data-commons-1.11.0.RELEASE.jar:na] at org.springframework.data.mapping.PropertyPath.create(PropertyPath .java:327)〜[spring-data-commons-1.11.0.RELEASE.jar:na] org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)〜[spring-data-commons- 1.11.0.RELEASE.jar:na] at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)〜[spring-data-commons-1.11.0.RELEASE.jar:na] at org. springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)〜[spring-data-commons-1.11.0.RELEASE.jar:na] at org.springframework.data.repository.query.parser.Part.( Part.java:76)〜[spring-data-commons-1.11.0.RELEASE.jar:
它们在禁用任何一个时都有效.
该项目基于Spring Boot 1.3.0.M5.
这是一个重现情况的示例项目:
https://github.com/izeye/spring-boot-throwaway-branches/tree/data-jpa-and-elasticsearch
spring-data spring-data-jpa spring-boot spring-data-elasticsearch
在ConversionPattern中使用%C和AsyncAppender时遇到问题.
我的Lo4J配置是:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy/MM/dd HH:mm:ss,SSS} %C{1} - %m%n" />
</layout>
</appender>
<appender name="async_console" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="1000" />
<appender-ref ref="console" />
</appender>
<root>
<level value="debug" />
<!--
<appender-ref ref="console" />
-->
<appender-ref ref="async_console" />
</root>
</log4j:configuration>
Run Code Online (Sandbox Code Playgroud)
我的测试代码是:
@Test
public void testAsync() {
DOMConfigurator
.configure("src/test/resources/learningtest/log4j/log4j_test_async.xml");
Logger log = Logger.getLogger(getClass());
log.debug("Hello, world!");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
测试代码的结果是:
2012/03/15 11:51:22,570?- 你好,世界! …
我认为Java按系统区域设置确定'file.encoding'系统属性.
但在我的系统中,系统区域设置为'ko_kr.UTF-8'时,'file.encoding'为'ANSI_X3.4-1968'.
Java如何确定'file.encoding'系统属性?
i7 CPU型号有很多种,如下所示:
http://en.wikipedia.org/wiki/List_of_Intel_Core_i7_microprocessors#Desktop_processors
如何知道我在Windows上使用的是哪个版本?
我正在尝试将HATEOAS与Spring HATEOAS一起使用,并且需要使用Spring HATEOAS将enums作为REST API公开.
我尝试了三种方法如下:
@RestController
@RequestMapping(path = "/fruits")
public class FruitResourceController {
@RequestMapping(method = RequestMethod.GET)
public Fruit[] fruits() {
return Fruit.values();
}
// NOTE: The `produces` attribute is only for browsers.
@RequestMapping(path = "/with-resource", method = RequestMethod.GET,
produces = MediaTypes.HAL_JSON_VALUE)
public Resource<Fruit[]> fruitsWithResource() {
Resource<Fruit[]> resource = new Resource<Fruit[]>(Fruit.values());
Link selfLink = linkTo(methodOn(FruitResourceController.class).fruitsWithResource())
.withSelfRel();
resource.add(selfLink);
return resource;
}
// NOTE: The `produces` attribute is only for browsers.
@RequestMapping(path = "/with-resources", method = RequestMethod.GET,
produces = MediaTypes.HAL_JSON_VALUE)
public …Run Code Online (Sandbox Code Playgroud) java ×3
encoding ×2
apache-kafka ×1
autocommit ×1
c ×1
cpu ×1
hateoas ×1
html ×1
javascript ×1
locale ×1
log4j ×1
mysql ×1
python ×1
rest ×1
rollback ×1
spring-boot ×1
spring-data ×1
sql-update ×1
string ×1
utf-16 ×1
utf-8 ×1
windows ×1