我已经设置了Hadoop 2.2.0单节点并启动了它.我能够浏览FS http://localhost:50070/
然后我尝试使用以下代码编写一个虚拟文件.
public class Test {
public void write(File file) throws IOException{
FileSystem fs = FileSystem.get(new Configuration());
Path outFile = new Path("test.jpg");
FSDataOutputStream out = fs.create(outFile);
}
Run Code Online (Sandbox Code Playgroud)
我得到以下异常
INFO: DEBUG - field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginSuccess with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[Rate of successful kerberos logins and latency (milliseconds)], about=, type=DEFAULT, always=false, sampleName=Ops)
INFO: DEBUG - field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginFailure with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[Rate of failed kerberos logins and latency (milliseconds)], about=, type=DEFAULT, always=false, sampleName=Ops)
INFO: DEBUG - UgiMetrics, User and group related …Run Code Online (Sandbox Code Playgroud) 我正在使用Cassandra 1.2.2.我发现使用Jackson可以很容易地将我的对象映射到json和java之间以便存储在数据库中.我实际上很想对我的所有数据这样做.我的问题是,这是个好主意吗?在我的应用程序中执行此操作有什么缺点.我的第一个猜测可能是更多的处理开销,但果汁值得挤压?还有其他我需要知道的缺点吗?
我正在关注commons文件上传站点中提供的关于流API的示例.我被困在试图弄清楚如何获取上传文件的文件扩展名,如何将文件写入目录,最糟糕的部分是编写示例评论的人在哪里// Process the input stream...让我想知道它是否是如此微不足道的我是唯一一个不懂得的人.
// parallel processing
int processors = Runtime.getRuntime().availableProcessors();
ExecutorService executorService = Executors.newFixedThreadPool(threads);
final List<String> albumIds2 = new ArrayList<String>();
long start2 = System.nanoTime();
for (final HColumn<String, String> column : result.get().getColumns()) {
Runnable worker = new Runnable() {
@Override
public void run() {
albumIds2.add(column.getName());
}
};
executorService.execute(worker);
}
long timeTaken2 = System.nanoTime() - start2;
Run Code Online (Sandbox Code Playgroud)
我有像上面的例子一样的代码,它创建了一个List<String>专辑ID.该列是来自cassandra数据库的切片.我记录要创建的整个专辑列表所用的时间.
我使用增强的for循环完成了同样的操作,如下所示.
QueryResult<ColumnSlice<String, String>> result = CassandraDAO.getRowColumns(AlbumIds_CF, customerId);
long start = System.nanoTime();
for (HColumn<String, String> column : result.get().getColumns()) {
albumIds.add(column.getName());
}
long timeTaken = System.nanoTime() - start; …Run Code Online (Sandbox Code Playgroud) 我正在编写一个 Java EE 6 Web 应用程序,这实际上是我正在编写的第一个认真的应用程序。我注意到我的类有 500 到 1000 行,并且可能会更大。我不知道一个类应该有多大,或者它是否重要,但我不想继续编写巨大的类,如果它会对应用程序性能产生负面影响。你对我有什么建议?
我在全球所有的链接都有这些样式.我无法在同一页面上覆盖div中的链接样式.
a, a:visited{
outline: 0;
cursor: pointer;
color: inherit;
text-decoration: none;
}
a:hover{
text-decoration: underline;
}
Run Code Online (Sandbox Code Playgroud)
现在我想覆盖锚点链接的样式,在悬停时将其颜色更改为白色,但只能看到看不见的多个类的div和像这样的通知容器......
<div class="unseen notificationContainer">
<a href="profile?customerId=1365764036258">
<strong>robert</strong>
</a>
sent you a friend request
<a href="friend_request?type=accept&notificationId=1365764054463">
Accept
</a>
<a href="friend_request?type=reject&notificationId=1365764054463">
Reject
</a>
</div>
Run Code Online (Sandbox Code Playgroud)
所以我将以下内容添加到我的CSS中
.unseen{
background: #09f;
color: #fff;
}
.unseen a :hover{
color: #fff;
text-decoration: underline;
}
Run Code Online (Sandbox Code Playgroud)
当页面加载悬停在第一个链接上时,将其颜色更改为白色,但其他三个颜色为背景的蓝色.过去一个小时我一直在这,而不仅仅是恼人的.notificationContainer的样式如下
.notificationContainer{
width: 390px;
float: left;
border-bottom: solid 1px #eee;
padding: 5px;
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.