我想在Intellij IDEA中使用Gradle启动一个空项目,但它似乎不像Eclipse那样方便.
我做的是File-> New Project-> Gradle.一个项目出现但它没有完成(例如它没有src文件夹).
我添加apply plugin 'idea'
了build.gradle.当我参考IntelliJ IDEA中的所有任务时.我没有idea,cleanIdea,ideaProject
设置IntelliJ IDEA.
在Eclipse + Gradle插件中,只需创建一个新的gradle项目,一切准备就绪.
我想知道如何在Intellij IDEA中做到这一点.
谢谢
我为具有集成Windows身份验证的域A用户提供了Asp.net网站.
现在,域B的用户需要访问该网站.
但是,域B用户会在访问网站时收到弹出窗口,以输入经过身份验证的信息
我的问题是:
如何配置IIS或Windows Server以允许域B用户访问网站而无需用于身份验证的弹出窗口,就像域A中的用户一样.
我正在使用Spring JDBCTemplate连接到SQL Server.
我有一个需要插入SQL Server表的对象列表.
我做的是以下内容:
public void batchInsert(final List<Bean> list) {
final String sql = "insert into temp"
+ "(id, name, amount, location, time, price) "
+ " values (?, ?, ?, ?, ?, ?)";
getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int i) throws SQLException {
Bean vo = list.get(i);
ps.setString(1, vo.getId());
ps.setString(2, vo.getName());
ps.setDouble(3, vo.getAmount());
ps.setString(4, vo.getLocation());
ps.setString(5, vo.getTime());
ps.setDouble(6, vo.getPrice());
}
@Override
public int getBatchSize() {
return list.size();
}
});
}
Run Code Online (Sandbox Code Playgroud)
但是现在,我想将参数List<Bean> list …
String abc = "a,b,c,d,,,";
String[] arr = abc.split(",");
System.out.println(arr.length);
Run Code Online (Sandbox Code Playgroud)
输出是4.但显然我的期望是7.这是我的解决方案:
String abc = "a,b,c,d,,,";
abc += "\n";
String[] arr = abc.split(",");
System.out.println(arr.length);
Run Code Online (Sandbox Code Playgroud)
为什么会这样?有谁可以给我一个更好的解决方案?
在blog-edit.html中,JQuery用于将post请求发送到服务器端(java servlet).
$("#btn").click(function() {
$.post("/blog/handler",{"content":$('#textarea').val()},
function(data){
alert("Data Loaded: " + data);
if(data.toString().length>1){
alert("Saved!")
}else{
alert("Failed!")
}
})
Run Code Online (Sandbox Code Playgroud)
在服务器端:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String content = request.getParameter("content");
System.out.println(content);
response.sendRedirect("/blog/list");
return;
}
Run Code Online (Sandbox Code Playgroud)
我看到的是服务器端正在从html打印内容,并弹出警报窗口说"已保存!".但重定向功能不起作用
搜索后我别无选择,只能使用jquery重定向:
if(data.toString().length>1){
alert("Saved!")
window.location.replace("/blog/list")
}
Run Code Online (Sandbox Code Playgroud)
它有效,但它不是我想要的
请帮忙
一个EventHandler
(DatabaseConsumer)Disruptor
调用存储过程在数据库中,这是如此之慢,以至于它会阻塞Disruptor
一段时间.
因为我需要Disruptor
保持运行而不会阻塞.我正在考虑添加一个额外的队列,以便EventHandler
可以作为Producer
另一个新创建的线程可以Consumer
用来处理数据库的工作,这可以是异步的,而不会影响Disruptor
这是一些约束:
Disruptor
传递给EventHandler
周围30KB这个对象的数量约为40万.理论上,需要处理的对象的总大小约为30KBX400K = 12GB.所以额外的队列应该足够了.我认为文本文件是一个选项.EventHandler
(生产者)将对象写入文件并Consumer
从中读取并调用存储过程.问题是如何处理它到达文件末尾的情况以及如何知道新的即将到来的行.
有谁解决过这种情况吗?有什么建议?
java asynchronous message-queue producer-consumer disruptor-pattern
我所做的是使用Grizzly
/ Jersey
来托管swagger-ui
,这是静态内容.
这是以下部分build.gradle
:
compile 'org.glassfish.jersey.core:jersey-server:2.22.1'
compile 'org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.22.1'
compile 'org.glassfish.jersey.containers:jersey-container-grizzly2-servlet:2.22.1'
Run Code Online (Sandbox Code Playgroud)
以下是使用以下方法配置静态内容的方法Grizzly
:
httpServer = GrizzlyWebContainerFactory.create(uri);
httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("swagger-ui"), "/swagger");
Run Code Online (Sandbox Code Playgroud)
swagger-ui
是项目根文件夹下的文件夹.
我访问http://localhost/swagger/
时一切都很好,但是当我尝试时http://localhost/swagger
,它只提供一个没有渲染的简单页面,似乎所有css/js文件都丢失了:
我想知道在没有尾部斜杠(/)的情况下制作url的最佳方法是什么是与斜杠斜杠相同的方法.
更新:我已经向swagger-ui提出了一张票:https://github.com/swagger-api/swagger-ui/issues/1966但它说这是Grizzly
另一张票的配置问题Grizzly
:https:// java .NET/JIRA /浏览/灰熊-1823
现在找不到解决方案.我正在考虑使用另一个Web服务器.
我有一个需要访问Excel文件的Web项目(.NET 4),但最终会出现以下错误消息:
Error occurred during file generation.Microsoft Excel cannot access the file 'D:\xx\xx\abc.xls'.
There are several possible reasons:
• The file name or path does not exist. (Actually it is there)
• The file is being used by another program. (It can not happen)
• The workbook you are trying to save has the same name as a currently open workbook.
Run Code Online (Sandbox Code Playgroud)
在IIS7中,我使用DefaultAppPool,其标识为"myservice",位于Administrators组下.
在IIS下的我的网站的身份验证页面中,启用了匿名身份验证并设置为"应用程序池标识"并禁用了ASP.NET模拟.
在搜索解决方案数小时后,我发现了以下内容,但没有一个能够正常工作
有一点奇怪,IIS_IUSRS组中没有任何内容.这是正常的吗?我记得至少有两个用户(DefaultAppPool和Classic .NET AppPool).
我认为这是IIS的权限问题,但我无法解决它.
我在asp.net中有以下代码:
<asp:dropdownlist id="ddlApp" runat="server" />
<asp:button id="btnSmt" runat="server" Text="Submit" />
Run Code Online (Sandbox Code Playgroud)
和代码背后:
private void btnSmt_Click(object sender, System.EventArgs e)
{
lbl.Text = ddlApp.SelectedItem.Value;
}
Run Code Online (Sandbox Code Playgroud)
逻辑非常简单.获取下拉列表的选定值并将其传递给lbl.text.
但问题是无论我如何尝试,文本显示下拉列表中列表的第一个值而不是选定的值.
而且我注意到每次单击按钮页面都会刷新.
请帮忙.
顺便说一句,我有以下事件绑定:
private void InitializeComponent()
{
this.btnSmt.Click += new System.EventHandler(this.btnSmt_Click);
this.Load += new System.EventHandler(this.Page_Load);
this.ddlApp.SelectedIndexChanged +=new System.EventHandler(this.ddlApp_Change);
}
Run Code Online (Sandbox Code Playgroud) 最近一个面试问题让我感到不确定.
对于TreeMap和HashMap中的get()方法,它的性能是什么?
a)平均值:常数(与n无关)最差:常数(与n无关)
b)平均值:常数(与n无关)最差:与log(n)成比例
c)平均值:常数(与n无关)最差:与(n)成比例
d)平均值:与log(n)成比例最差:与(n)成比例
哪个是对的?