我一直在tomcat 7.30(eclipse juno)上得到这个
至少有一个JAR被扫描用于TLD但尚未包含TLD.为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表.在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间.
我于是在conf\logging.properties转身都INFO以FINE和注释掉线
# To see debug messages in TldLocationsCache, uncomment the following line:
org.apache.jasper.compiler.TldLocationsCache.level = FINE
Run Code Online (Sandbox Code Playgroud)
我仍然看到 At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging...
那么我该怎么做才能看到这些罐子呢?
日志位置:
tomcat日志位于$ CATALINA_HOME\logs\catalina.yyyy-mm-dd.log中.Eclipse在控制台中打印它们 - 如果您想要记录您的控制台,您必须
在服务器选项卡中,双击Tomcat服务器.您将看到一个名为Overview的屏幕.单击"打开启动配置".单击"Common"选项卡.在屏幕底部,您可以选中"文件"复选框,然后指定一个可用于记录控制台(catalina.out)输出的文件.最后,重启Tomcat服务器.
我不在乎差异是什么.我只是想知道内容是否不同.
显然这个:
git log --all --after="<date> 00:00" --before="<date> 23:59" --author="<author>"
Run Code Online (Sandbox Code Playgroud)
过滤器根据提交者日期提交.如何让它显示指定作者日期范围的提交?
我的同事建议将几个Eclipse代码格式和警告设置更严格.这些变化中的大多数都是有意义的,但我在Java中得到了一个奇怪的警告.这里有一些重现"问题"的测试代码:
package com.example.bugs;
public class WeirdInnerClassJavaWarning {
private static class InnerClass
{
public void doSomething() {}
}
final private InnerClass anInstance;
{
this.anInstance = new InnerClass(); // !!!
this.anInstance.doSomething();
}
}
// using "this.anInstance" instead of "anInstance" prevents another warning,
// Unqualified access to the field WeirdInnerClassJavaWarning.anInstance
Run Code Online (Sandbox Code Playgroud)
与!!!线!使用我的新警告设置在Eclipse中向我发出此警告:
对包含构造函数WeirdInnerClassJavaWarning.InnerClass()的访问由合成访问器方法模拟.提高其可见性将改善您的表现.
这是什么意思?当我将"私有静态类"更改为"受保护的静态类"时,警告就消失了,这对我来说毫无意义.
编辑:我终于找到了"正确"修复.这里真正的问题似乎是这个嵌套的私有静态类缺少一个公共构造函数.那一个调整删除了警告:
package com.example.bugs;
public class WeirdInnerClassJavaWarning {
private static class InnerClass
{
public void doSomething() {}
public InnerClass() {}
}
final private InnerClass anInstance;
{
this.anInstance = new InnerClass(); …Run Code Online (Sandbox Code Playgroud) 在NetBeans中,有一个新提示:Thread.sleep在循环中调用.
问题1:如何/何时在循环中睡觉是一个问题?
问题2:如果这是一个问题,我该怎么做?
更新:问题3:这是一些代码.在这种情况下告诉我,如果我应该在循环中使用其他东西而不是Thread.Sleep.简而言之,这是由侦听客户端TCP连接的服务器使用的.此处使用睡眠以防达到与客户端的最大会话数.在这种情况下,我希望应用程序等到免费会话可用.
public class SessionManager {
private static final int DEFAULT_PORT = 7500;
private static final int SLEEP_TIME = 200;
private final DatabaseManager database = new DatabaseManager();
private final ServerSocket serverSocket = new ServerSocket(DEFAULT_PORT);
public SessionManager() throws IOException, SQLException
{
}
public void listen()
{
while (true)
if (Session.getSessionCount() < Session.getMaxSessionCount())
try
{
new Thread(new Session(database, serverSocket.accept())).start();
}
catch (IOException ex) { ex.printStackTrace(); }
else
try
{
Thread.sleep(SLEEP_TIME);
}
catch (InterruptedException ex) { ex.printStackTrace(); …Run Code Online (Sandbox Code Playgroud) 我只是尝试这个小样本项目,它所做的一切:活动一有一个发送广播的按钮.活动二在收到时显示祝酒词.下面是代码,从未收到广播.我做错了什么?
发送广播
public class SendBroadcast extends Activity {
public static String BROADCAST_ACTION = "com.unitedcoders.android.broadcasttest.SHOWTOAST";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void sendBroadcast(View v){
Intent broadcast = new Intent();
broadcast.setAction(BROADCAST_ACTION);
sendBroadcast(broadcast);
}
}
Run Code Online (Sandbox Code Playgroud)
接收它
public class ToastDisplay extends Activity {
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(getApplicationContext(), "received", Toast.LENGTH_SHORT);
}
};
@Override
protected void onResume() {
IntentFilter filter = …Run Code Online (Sandbox Code Playgroud) 我试图使用TensorFlow在Python中实现多元线性回归,但遇到了一些逻辑和实现问题.我的代码抛出以下错误:
Attempting to use uninitialized value Variable
Caused by op u'Variable/read'
Run Code Online (Sandbox Code Playgroud)
理想情况下,weights输出应该是[2, 3]
def hypothesis_function(input_2d_matrix_trainingexamples,
output_matrix_of_trainingexamples,
initial_parameters_of_hypothesis_function,
learning_rate, num_steps):
# calculate num attributes and num examples
number_of_attributes = len(input_2d_matrix_trainingexamples[0])
number_of_trainingexamples = len(input_2d_matrix_trainingexamples)
#Graph inputs
x = []
for i in range(0, number_of_attributes, 1):
x.append(tf.placeholder("float"))
y_input = tf.placeholder("float")
# Create Model and Set Model weights
parameters = []
for i in range(0, number_of_attributes, 1):
parameters.append(
tf.Variable(initial_parameters_of_hypothesis_function[i]))
#Contruct linear model
y = tf.Variable(parameters[0], "float")
for i in range(1, number_of_attributes, …Run Code Online (Sandbox Code Playgroud) 从官方文档:
使用外部存储
每个Android兼容设备都支持可用于保存文件的共享"外部存储".这可以是可移动存储介质(如SD卡)或内部(不可移动)存储...
我对这个问题感到很困惑.据我所知,使用外置存储并不一定意味着使用可移动卡,我是对的吗?但是,在谈论外部存储时,它总是被称为"SD卡".
我正在开发一个从互联网上下载.mp3文件的应用程序.我想将这些文件保存在手机内存中(不想使用任何可移动设备),但是对于我所学到的,这些文件必须保存在外部存储器中.但是,我想提供导入的可能性.来自可移动设备的文件.我应该在哪里以及如何保存这些文件?
谢谢
正如标题所说,我想保存并检索某些字符串.但我的代码不会在检索或存储中通过第一行.我尝试按照以下链接:http://developer.android.com/guide/topics/data/data-storage.html
private void savepath(String pathtilsave, int i) {
String tal = null;
// doesn't go past the line below
SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
tal = String.valueOf(i);
editor.putString(tal, pathtilsave);
editor.commit();
}
Run Code Online (Sandbox Code Playgroud)
和我的检索方法:
public void getpaths() {
String tal = null;
// doesn't go past the line below
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
for (int i = 1; i <= lydliste.length - 1; i++) {
tal = String.valueOf(i);
String restoredText = settings.getString(tal, null);
if (restoredText != null) {
lydliste[i] …Run Code Online (Sandbox Code Playgroud) 我想实现一个显示对话框的方法,等待对话框解除,然后根据对话框内容返回结果.这可能吗?
public String getUserInput()
{
//do something to show dialog
String input = //get input from dialog
return input;
}
Run Code Online (Sandbox Code Playgroud)
我实际上是在尝试实现一个具有方法"public String getUserInput()"的接口,其中必须通过对话框检索返回的String.这很容易在java中完成,在android中似乎不可能?
编辑:根据评论中的要求发布一些示例代码
getInput()必须从后台线程调用(我从AsynchTask中调用它).getInput()显示一个对话框并调用wait.在对话框上按下确定按钮时,对话框在成员变量中设置用户输入并调用notify.调用notify时,getInput()继续并返回成员变量.
String m_Input;
public synchronized String getInput()
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
AlertDialog.Builder alert = new AlertDialog.Builder(context);
//customize alert dialog to allow desired input
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton)
{
m_Input = alert.getCustomInput();
notify();
}
});
alert.show();
}
});
try
{
wait();
}
catch (InterruptedException e) …Run Code Online (Sandbox Code Playgroud)