小编lol*_*f64的帖子

Tapestry 5.3教程和Eclipse Kepler:无法加载RegistryStartup服务

我正在尝试遵循 官方的Tapestry教程

以下步骤很好:

  • 启动mvn jetty:run(从命令行)
  • 启动mvn eclipse:eclipse -DdownloadSources = true
  • 在Eclipse中导入项目
  • 从Eclipse中导入的项目配置新的Jetty配置

但是一旦我从Eclipse运行配置,我就会收到一个错误,其日志就在这里.(相关部分,据我说:

ioc.Registry Error building service proxy for service 'RegistryStartup'
Run Code Online (Sandbox Code Playgroud)

)

另外,请注意,我的问题是从一个不同的这篇文章:的确,我已经成功地建立了6码头在Eclipse中.

我的操作系统是Ubuntu 13.10 64位.

在ubuntu上我安装了Maven 3.1.1

我正在使用Eclipse Kepler Service Release 2

我安装了jetty插件(RunJettyRun)1.3.2(Jetty 6).

另外,在Eclipse中我设置了补丁以使用java8运行时.

eclipse tapestry jetty

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

wcout函数不会打印法语字符

我使用wcin来在wchar_t中存储单个字符.然后我尝试使用wcout调用和法语字符'é'打印它:但我无法在我的控制台上看到它.

我的编译器是g ++ 4.5.4,我的操作系统是Ubuntu 12.10 64位.

这是我的尝试(wideChars.cpp):

#include <iostream>

int main(){
    using namespace std;

    wchar_t aChar;
    cout << "Enter your char : ";
    wcin >> aChar;
    wcout << L"You entered " << aChar << L" .\n";

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

当我开始编程时:

$ ./wideChars 
Enter your char : é
You entered  .
Run Code Online (Sandbox Code Playgroud)

那么,这段代码有什么问题?

c++ g++ wchar-t

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

如何在Kotlin中序列化/反序列化Custom对象数组?

在我的Kotlin Android项目中,我创建了一个扩展Serializable的FileItem类

class FileItem(<parameters>) : Serializable, Comparable<FileItem> {
Run Code Online (Sandbox Code Playgroud)

所以我需要将此类的实例序列化为Bundle

val arguments:Bundle = Bundle()
arguments.putSerializable("folders", folders as Serializable)
Run Code Online (Sandbox Code Playgroud)

其中文件夹已声明为:

folders:Array<FileItem> (method parameter)
Run Code Online (Sandbox Code Playgroud)

上面的序列化代码编译没有任何警告.同时,当我需要反序列化文件夹项时出现问题:

val arguments: Bundle? = getArguments()
if (arguments != null){
    foldersItems = arguments.getSerializable("folders") as Array<FileItem>
Run Code Online (Sandbox Code Playgroud)

其中的foldersItems声明为

var foldersItems: Array<FileItem>?
Run Code Online (Sandbox Code Playgroud)

我得到以下警告,如果没有suppress_warning注释,我无法解决:

w: <Path to my class>: (78, 28): Unchecked cast: java.io.Serializable! to kotlin.Array<com.loloof64.android.chess_positions_archiver.main_file_explorer.FileItem>
Run Code Online (Sandbox Code Playgroud)

这种代码在Java/Groovy中编译而没有警告(folderItems则是FileItem []),那么如何修改kotlin代码以使编译器"满意"?

在Kotlin官方文档中注意到Kotlin Array没有扩展Serializable并且不能继承.是否有可能通过一种扩展方法"添加"它?

arrays serialization kotlin

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

为什么 kotlin File 类没有 close 方法?

我一直在阅读KotlinDoc 的 stdlib/kotlin.io.File 类。但是我看不到任何提及 close() 方法或自动关闭功能的内容:那么当 File 实例被垃圾收集时到底发生了什么?

kotlin

3
推荐指数
1
解决办法
2503
查看次数

C语言:如何解释这个#define?

我在网站上找到了这个片段:

#define DISPLAY_CR  (*(volatile unsigned int *) 0x4000000) 
DISPLAY_CR = somevalue;
Run Code Online (Sandbox Code Playgroud)

应该将DISPLAY_CR描述为指向地址0x4000000的易失性无符号int指针

我不明白的原因是:

  • 双括号重叠?
  • 两颗星使用(为什么两颗恒星而不仅仅是一颗?)

c pointers c-preprocessor

2
推荐指数
1
解决办法
456
查看次数

Scala阶乘法(即"!"):删除点运算符?

我设法在scala中为Integer定义一个新的运算符:"!" 阶乘算子.同时,我想在没有点运算符的情况下调用它,这样就不会抛出任何警告(我不想禁用警告功能).可能吗 ?

这是我的测试代码:

implicit.scala

implicit class IntegerUtils(wrapped:Int) {
    def !() = (2 to wrapped).product
}

(1 to 5).foreach { v => println (v.!) }
Run Code Online (Sandbox Code Playgroud)

scala implicit-conversion

2
推荐指数
1
解决办法
582
查看次数

错误的css">"选择器(由我)

我正在尝试用css3设计一个棋盘,但看起来我的选择器是错误的.这是我的JsFiddle

那么为什么我不能在线条和单元格周围看到设计的测试蓝色和红色边框?

HTML

<body>
    My chess board
    <table class="chess_board">
       <tr class="chess_line">
          <td class="chess_cell black_cell white_piece"><span>&#9812;</span></td>
          <td class="chess_cell white_cell white_piece"><span>&#9813;</span></td>
          <td class="chess_cell black_cell white_piece"><span>&#9814;</span></td>
          <td class="chess_cell white_cell white_piece"><span>&#9815;</span> </td>
       </tr>
       <tr class="chess_line">
          <td class="chess_cell white_cell"><span>&#9820;</span></td>
          <td class="chess_cell black_cell"><span>&#9821;</span></td>
          <td class="chess_cell white_cell"><span>&#9822;</span></td>
          <td class="chess_cell black_cell"><span>&#9823;</span></td>
      </tr>
    </table>
    My another chess board ... to be drawn !
</body>
Run Code Online (Sandbox Code Playgroud)

CSS

table.chess_board > tr.chess_line {
  background-color: blue;
}

table.chess_board > tr.chess_line > td.chess_cell {
  border: 2px solid red;
 /*
  font-family: serif;
  font-size: 2.3em;
  width: …
Run Code Online (Sandbox Code Playgroud)

css css-selectors

2
推荐指数
1
解决办法
89
查看次数

我们可以在不失去任何价值的情况下使用 LiveData 吗?

I would like to use a LiveData for handling kind of notifications, as it is already lifecycle aware, between a custom view and its wrapping fragment. But it seems that a LiveData may loose values : it will only update to its most recent state and also won't fire values during inactive state of its observers.

I've looked at the SingleLiveEvent purpose from Google code samples, but that solution does not seems to be battle tested yet, and the ticket …

android android-livedata

2
推荐指数
1
解决办法
775
查看次数

在(私有)继承的向量<string>上获取迭代器

我已经在我的自定义类上定义了vector的私有继承,我想在它上面得到一个迭代器.但我收到转换错误.

这是我的solutions.h

#include <vector>
#include <string>

#ifndef SOLUTIONS_H_
#define SOLUTIONS_H_

class Solutions : private std::vector<std::string>
{
public:
    using std::vector<std::string>::begin;
    using std::vector<std::string>::end;
    using std::vector<std::string>::push_back;
    void Show() const;
};

#endif
Run Code Online (Sandbox Code Playgroud)

这是我的solutions.cpp

#include <iostream>
#include "solutions.h"

using std::cout;
using std::endl;
using std::vector;
using std::string;


void Solutions::Show() const
{   
    cout << "Solutions : " << endl;
    if ( ! vector<string>::empty() )
    {
        for (vector<string>::iterator it = begin(); it != end(); ++it)
        {
            cout << *it << endl;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的test_solutions.cpp

#include "solutions.h"

int …
Run Code Online (Sandbox Code Playgroud)

c++ string vector

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

为什么编译器找不到android.R.id.home常量?

在我的android的kotlin项目中,我得到一个错误,说android.R.id.home是未定义的.同时,我将最小的android sdk修复为14.我正在使用Kotlin'1.0.1-2'.

以下是需要它的代码的摘录(它是一个Activity,一个普通的,而不是AppCompatAcitivity)

override fun onOptionsItemSelected(item: MenuItem): Boolean {
    when (item.getItemId()){
        is android.R.id.home -> {
            NavUtils.navigateUpFromSameTask(this)
            return true
        }
    }
    return super.onOptionsItemSelected(item)
}
Run Code Online (Sandbox Code Playgroud)

这是错误:

e: $<path_start_from_my_disc>/AboutActivity.kt: (70, 29): Unresolved reference: home
Run Code Online (Sandbox Code Playgroud)

android kotlin

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

用对象项填充 listView 的正确方法?

在我的 NativeScript 项目中,我试图用自定义对象(定义为接口)的实例填充 ListView。但是输出(在 android 模拟器上)很奇怪:我在多行中生成了“[object object ... object]”,而不是像我定义的那样获取每个实例名称内容。

这是我的 component.ts :

import {Component} from "@angular/core";

interface FileItem {
    isDirectory:boolean;
    name:String;
}

@Component({
    moduleId: module.id,
    selector: 'file-explorer',
    templateUrl: 'component.html',
    styleUrls: ['component.css']
})
export class FileExplorerComponent {
    public fileItems:Array<FileItem>;

    constructor(){
        this.fileItems = [
            {isDirectory: false, name:'ex03.fen'},
            {isDirectory: true, name:'test06'},
            {isDirectory: true, name:'test01'},
            {isDirectory: false, name:'ex02.fen'},
            {isDirectory: true, name:'test05'},
            {isDirectory: true, name:'test02'},
            {isDirectory: false, name:'ex01.fen'},
            {isDirectory: false, name:'ex05.fen'},
            {isDirectory: false, name:'ex03.fen'},
            {isDirectory: true, name:'test04'},
            {isDirectory: true, name:'test03'},
            {isDirectory: false, name:'ex04.fen'},
        ]
    } …
Run Code Online (Sandbox Code Playgroud)

android listview object nativescript

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

怎么能说一个函数输入应该是一个列表?

我需要对一个函数进行原型化,说toList,它以列表作为唯一参数,并返回一个列表列表(其类型与原始列表相同).例如[Char]会给我们一个[[Char]].

我试过了 :

(List a) => a -> [a]
Run Code Online (Sandbox Code Playgroud)

由于班级列表不存在而无法工作.

那我该怎么办?

提前致谢

haskell constraints function list

0
推荐指数
1
解决办法
78
查看次数

为什么我不能使用数组声明的类型推断?

Animal为了在Rust中试验多态,我声明了一个自定义特征的数组,但编译器似乎对第一个元素的子类型进行了类型推断:

fn main() {
    let animals = [Cat, Dog, Cat, Lion, Dog, Lion];
    for single_animal in animals {
        single_animal.talk();
    }
}

trait Animal {
    fn talk(&self);
}

struct Cat;
struct Dog;
struct Lion;

impl Animal for Cat {
    fn talk(&self) { 
        println!("Je miaule !");
    }
}

impl Animal for Dog {
    fn talk(&self) { 
        println!("J'aboie !");
    }
}

impl Animal for Lion {
    fn talk(&self) {
        println!("Je rugit !");
    }
}
Run Code Online (Sandbox Code Playgroud)

编译器抱怨第一个元素是a Cat而不是其他元素:

error: mismatched types [--explain E0308] …
Run Code Online (Sandbox Code Playgroud)

arrays polymorphism rust

0
推荐指数
1
解决办法
93
查看次数