我想配置logback来执行以下操作.
除了最后一项,启动滚动,我已经完成了所有工作.有谁知道如何实现这一目标?这是配置......
<appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg \(%file:%line\)%n</Pattern>
</layout>
<File>server.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>server.%d{yyyy-MM-dd}.log</FileNamePattern>
<!-- keep 7 days' worth of history -->
<MaxHistory>7</MaxHistory>
<TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<MaxFileSize>50MB</MaxFileSize>
</TimeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
Run Code Online (Sandbox Code Playgroud) 我有一个设置变量的静态方法:
static String[] playersNames;
public static void setParameters(String[] players) {
playersNames = players;
}
Run Code Online (Sandbox Code Playgroud)
然后我有一个静态块:
static {
JRadioButton option;
ButtonGroup group = new ButtonGroup();
// Wright a short explanation of what the user should do.
partnerSelectionPanel.add(new JLabel("Pleas select a partner:"));
// Generate radio-buttons corresponding to the options available to the player.
// Bellow is the problematic line causing the null pointer exception:
for (String playerName: playersNames) {
final String pn = playerName;
option = new JRadioButton(playerName, false);
option.addActionListener(new ActionListener(){
@Override …Run Code Online (Sandbox Code Playgroud) 我是在我的Rails应用程序中实现OpenID的第一步. open_id_authentication似乎是一个相当容易使用的插件,这就是我决定使用它的原因.
使用我的Google帐户登录似乎完美无缺,但是我没有得到我需要的sreg/AX字段.我的代码目前如下:
class SessionsController < ApplicationController
def new; end
def create
open_id_authentication
end
protected
def open_id_authentication
authenticate_with_open_id(params[:openid_identifier], :required => ["http://axschema.org/contact/email"]) do |result, identity_url, registration|
if result.successful?
p registration.data
@current_user = User.find_by_identity_url(identity_url)
if @current_user
successful_login
else
failed_login "Sorry, no user by that identity URL exists (#{identity_url})"
end
else
failed_login result.message
end
end
end
private
def successful_login
session[:user_id] = @current_user.id
redirect_to(root_url)
end
def failed_login(message)
flash[:error] = message
redirect_to(new_session_url)
end
end
Run Code Online (Sandbox Code Playgroud)
我已经阅读了有关Google OpenID的各种讨论,并且只是说您需要使用AX架构而不是sreg字段email,但即使我这样做(正如您在上面的代码中看到的那样),registration.data仍将保留空({}).
如何通过open_id_authentication有效地要求大多数OpenID提供商提供的电子邮件?
从星期四开始,我一直在用这个小问题敲打砖墙,而且我还没有比那时候更接近答案.
我有一个用户控件,它有如下属性:
/// <summary>
/// Gets or sets the media types.
/// </summary>
/// <value>The media types.</value>
public List<MediaType> MediaTypesFilter { get; set; }
Run Code Online (Sandbox Code Playgroud)
MediaType是一个枚举,包含None,PDF,Image等.
我想要的是能够在设计时设置用户控件的mediatypes(使用intellisense),例如:
<CMS:MediaPicker ID="MediaPicker runat="server" MediaTypesFilter="PDF, Image">
Run Code Online (Sandbox Code Playgroud)
或者更可能导致这样的事情:
<CMS:MediaPicker ID="MediaPicker" runat="server">
<MediaTypesFilter>
<MediaType>PDF</MediaType>
<MediaType>Image</MediaType>
</MediaTypesFilter>
</CMS:MediaPicker>
Run Code Online (Sandbox Code Playgroud)
我想我需要在属性上使用属性,比如DesignerSerializationVisbility等,但我无法弄明白.我读过有关CollectionEditors的内容,我读过的内容表明默认的CollectionEditor应该能够处理这个问题,所以我认为我不需要创建自定义的CollectionEditor.到目前为止,我最接近的是内部属性,无法设置哪种媒体类型.我似乎无法找到枚举列表的任何示例作为在设计时使用的属性.有人可以指出我正确的方向或给我一些示例代码做我正在尝试做的事情?
现在,我最终得到了一个逗号分隔的字符串,并且在我需要它时会以编程方式将其拆分为一个列表,但这意味着在设计时没有智能感知,这很糟糕.
我正在为我正在制作的Android应用程序的网站发出HTTP get请求.
我正在使用DefaultHttpClient并使用HttpGet发出请求.我得到实体响应,从中获取一个InputStream对象来获取页面的html.
然后我循环完成回复,如下所示:
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
String x = "";
x = r.readLine();
String total = "";
while(x!= null){
total += x;
x = r.readLine();
}
Run Code Online (Sandbox Code Playgroud)
然而,这非常缓慢.
这效率低吗?我没有加载一个大的网页 - www.cokezone.co.uk所以文件大小不大.有一个更好的方法吗?
谢谢
安迪
嗨,我试图将unicode字符串输出到带有iostreams的控制台并失败.
我发现了这一点: 在c ++控制台应用程序中使用unicode字体 ,这个代码片段有效.
SetConsoleOutputCP(CP_UTF8);
wchar_t s[] = L"èéøÞ????æ?a";
int bufferSize = WideCharToMultiByte(CP_UTF8, 0, s, -1, NULL, 0, NULL, NULL);
char* m = new char[bufferSize];
WideCharToMultiByte(CP_UTF8, 0, s, -1, m, bufferSize, NULL, NULL);
wprintf(L"%S", m);
Run Code Online (Sandbox Code Playgroud)
但是,我没有找到任何方法来使用iostream正确输出unicode.有什么建议?
这不起作用:
SetConsoleOutputCP(CP_UTF8);
utf8_locale = locale(old_locale,new boost::program_options::detail::utf8_codecvt_facet());
wcout.imbue(utf8_locale);
wcout << L"¡Hola!" << endl;
Run Code Online (Sandbox Code Playgroud)
编辑 我找不到任何其他解决方案,而不是在流中包装此片段.希望,有人有更好的想法.
//Unicode output for a Windows console
ostream &operator-(ostream &stream, const wchar_t *s)
{
int bufSize = WideCharToMultiByte(CP_UTF8, 0, s, -1, NULL, 0, NULL, NULL);
char *buf = …Run Code Online (Sandbox Code Playgroud) 它发生在我的代码中的同一个地方(虽然不是第一次执行该方法)但我无法做出错误的头或尾.(因此它是机器人的代码).
如果有人可以让我知道它是什么类型的问题,那么最感激.我认为它与线程(多线程应用程序)有关,但我真的不知道是什么?!?担心uni项目的截止日期迫在眉睫!
消息:
# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0xb70f0ca7, pid=5065, tid=2145643376 # # JRE version: 6.0_15-b03 # Java VM: Java HotSpot(TM) Server VM (14.1-b02 mixed mode linux-x86 ) # Problematic frame: # V [libjvm.so+0x4c9ca7] # # An error report file with more information is saved as: # /home/thomas/workspace/sir13/hs_err_pid5065.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp #
日志:
# # …