不知怎的,我从调试窗口关闭了logcat选项卡,现在我无法将其恢复.在Run-> Configuration-> Logcat中,我检查了所有内容.我在Android Monitor窗口中有logcat选项卡,但在Debug中没有.我怎样才能找回来?
我在他们的bug追踪器上创建了一个bug:https://youtrack.jetbrains.com/issue/IDEA-144525
我有以下数据框,我想使用强制转换来创建一个"数据透视表",其中包含两个值(值和百分比)的列.这是数据框:
expensesByMonth <- structure(list(month = c("2012-02-01", "2012-02-01", "2012-02-01",
"2012-02-01", "2012-02-01", "2012-02-01", "2012-02-01", "2012-02-01",
"2012-02-01", "2012-02-01", "2012-02-01", "2012-02-01", "2012-03-01",
"2012-03-01", "2012-03-01", "2012-03-01", "2012-03-01", "2012-03-01",
"2012-03-01", "2012-03-01", "2012-03-01", "2012-03-01", "2012-03-01",
"2012-03-01", "2012-03-01", "2012-03-01", "2012-03-01", "2012-04-01",
"2012-04-01", "2012-04-01", "2012-04-01", "2012-04-01", "2012-04-01",
"2012-04-01", "2012-04-01", "2012-04-01", "2012-04-01", "2012-04-01",
"2012-04-01", "2012-04-01", "2012-04-01", "2012-04-01", "2012-04-01",
"2012-04-01", "2012-04-01", "2012-05-01", "2012-05-01", "2012-05-01",
"2012-05-01", "2012-05-01", "2012-05-01", "2012-05-01", "2012-05-01",
"2012-05-01", "2012-05-01", "2012-05-01", "2012-05-01", "2012-05-01",
"2012-05-01", "2012-05-01", "2012-05-01", "2012-05-01", "2012-05-01",
"2012-06-01", "2012-06-01", "2012-06-01", "2012-06-01", "2012-06-01",
"2012-06-01", "2012-06-01", "2012-06-01", "2012-06-01", "2012-06-01",
"2012-06-01", "2012-06-01", …Run Code Online (Sandbox Code Playgroud) 我一直在寻找如何绘制一个家谱,但找不到我可以复制的东西.我一直在寻找哈德利关于ggplot的书,但同样的事情.
我想绘制一个家族树,其中包含与此类似的数据帧作为源:
dput(head(familyTree))
structure(
list(
id = 1:6,
cnp = c("11", NA, "22", NA, NA, "33"),
last_name = c("B", "B", "B", NA, NA, "M"),
last_name_alyas = c(NA, NA, NA, NA, NA, "M"),
middle_name = c("C", NA, NA, NA, NA, NA),
first_name = c("Me", "P", "A", NA, NA, "S"),
first_name_alyas = c(NA, NA, NA, NA, NA, "F"),
maiden_name = c(NA, NA, "M", NA, NA, NA),
id_father = c(2L, 4L, 6L, NA, NA, 8L),
id_mother = c(3L, 5L, 7L, NA, NA, 9L), …Run Code Online (Sandbox Code Playgroud) 我不小心drawer_list_item.xml在屏幕截图中使用New -> File菜单创建,而不是New -> Layout resource file现在我无法在设计模式下将其作为常规布局文件打开.它将其作为纯文本文件打开.
有什么方法可以改变它的类型.我通过Android Studio的设置找不到与此相关的任何内容
文件内容:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
编辑我尝试过的更多内容:
重新创建不起作用,因为它以相同的方式创建它.但是,当我在删除后重新创建它时,会给出以下异常.我关闭窗口,旧的文本文件重新出现
null
java.lang.AssertionError
at org.jetbrains.android.util.AndroidResourceUtil.createFileResource(AndroidResourceUtil.java:1251)
at org.jetbrains.android.actions.CreateTypedResourceFileAction.doCreateAndNavigate(CreateTypedResourceFileAction.java:131)
at org.jetbrains.android.actions.CreateMultiRootResourceFileAction.create(CreateMultiRootResourceFileAction.java:108)
at org.jetbrains.android.actions.CreateResourceActionBase$MyInputValidator.create(CreateResourceActionBase.java:292)
at com.intellij.ide.actions.ElementCreator$1.run(ElementCreator.java:73)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1010)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
at com.intellij.ide.actions.ElementCreator.tryCreate(ElementCreator.java:92)
at org.jetbrains.android.actions.CreateResourceActionBase$MyInputValidator.canClose(CreateResourceActionBase.java:302)
at org.jetbrains.android.actions.CreateMultiRootResourceFileAction$MyDialog.doOKAction(CreateMultiRootResourceFileAction.java:174)
at com.intellij.openapi.ui.DialogWrapper$OkAction.doAction(DialogWrapper.java:1833)
at com.intellij.openapi.ui.DialogWrapper$DialogWrapperAction.actionPerformed(DialogWrapper.java:1799)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at …Run Code Online (Sandbox Code Playgroud)我有我创建的这个测试项目,由2个项目组成:一个使用spring-boot,另一个使用spring-mvc.他们每个人都很好地独立工作.我想要做的是运行spring-boot并通过加载其上下文来访问spring-mvc项目的网页.该项目非常简单,因为我只想测试如何进行混音.
问题是,当我运行spring-boot应用程序时,spring-mvc中的页面无法访问,因为它不会在构建中添加webbapp文件夹(包含WEB-INF).我能够在spring-boot应用程序中从spring-mvc自动装配服务.
树看起来如下:
spring-boot的Application.java类如下:
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import java.util.Arrays;
@SpringBootApplication
@ComponentScan({"org.burdu", "hello"})
//@ImportResource({"classpath:WEB-INF/spring-core-config.xml", "classpath:WEB-INF/spring-mvc-config.xml"})
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
Run Code Online (Sandbox Code Playgroud)
root build.gradle
group 'net.burdu'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
}
dependencies …Run Code Online (Sandbox Code Playgroud) 我有一个使用spring xml的遗留应用程序,我正在迁移到spring-boot.
应用程序启动,我获得了身份验证页面,映射到applicationContext-login.xml中.在登录成功时,它应该加载WEB-INF/client/home.jsp,但是,它尝试加载/WEB-INF/auth/home.jsp,我得到404.在启动日志中,我看到它映射所有路径.为什么在这些重定向上存在冲突,我该怎么做才能解决这个问题?由于多个包含视图解析器的@ImportResource会遇到问题吗?
从安全性http配置中提取:
<s:http use-expressions="true" entry-point-ref="delegatingAuthenticationEntryPoint">
<s:form-login login-page="/auth/login"
login-processing-url="/auth/j_spring_security_check"
authentication-failure-url="/auth/login-secure?loginFailed=true"
default-target-url="/auth/defaultEntry"/>
<s:logout logout-url="/auth/logout" logout-success-url="/auth/logout-success" delete-cookies="jsessionid"/>
</s:http>
Run Code Online (Sandbox Code Playgroud)
它指向的控制器:
@RequestMapping(value = "/defaultEntry", method = RequestMethod.GET)
public String defaultEntry() {
if (authentication.isAuthenticated()) {
return "redirect:/client/home";
} else {
return "redirect:login";
}
}
Run Code Online (Sandbox Code Playgroud)
该应用程序在xml文件中配置了多个视图解析器:
类路径*:/ springContext /的applicationContext-login.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd"
default-init-method="init"
default-destroy-method="destroy">
<import resource="applicationContext-web-common.xml" />
<!-- Static login resources -->
<mvc:resources mapping="/css/**" location="/WEB-INF/auth/css/"/>
<mvc:resources mapping="/assets/**" location="/WEB-INF/auth/assets/"/>
<mvc:resources mapping="/js/**" …Run Code Online (Sandbox Code Playgroud)如何在Java中运行.sql脚本(来自文件)并ResultSet使用Spring 返回?
我有一个程序SQL在数据库上运行查询,返回后ResultSet我处理并使用我的类中的数据.我目前正在使用JDBCJava程序中的脚本.
StringBuilder query = new StringBuilder("some script on multiple lines");
PreparedStatement statement = connection.prepareStatement(query.toString());
ResultSet resultSet = statement.executeQuery();
Run Code Online (Sandbox Code Playgroud)
我想将Java程序之外的SQL查询移动到.sql文件,但我想保留executeQuery语句中的所有程序逻辑.这意味着我希望查询返回ResultSet.
我查看了几个方法,比如使用a ScriptRunner,使用Spring JdbcTestUtils.executeSqlScript或使用a 读取.sql文件BufferReader,然后将字符串传递给我的语句.在ScriptRunner和Spring JdbcTestUtils.executeSqlScript似乎不返回ResultSet,或者我找不到正确执行.我想要远离该BufferReader方法,因为它需要文本解析和许多异常来处理.
ScriptRunner scriptRunner = new ScriptRunner(connection, true, true);
scriptRunner.runScript(new FileReader("script.sql"));
Run Code Online (Sandbox Code Playgroud)
该runScript方法返回void.Spring实现方式相同:
MysqlDataSource ds = new MysqlDataSource();
ds.setServerName("host");
ds.setUser("user");
ds.setPassword("password");
JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);
Resource resource = new ClassPathResource("script.sql");
JdbcTestUtils.executeSqlScript(jdbcTemplate, resource, true); …Run Code Online (Sandbox Code Playgroud)