我刚刚在安装了Postgres 9.1的OSX Lion 10.7.3 pc上安装了PgAdmin 8.4.当我尝试添加数据库时,收到一条错误消息:"错误:列'dataconfig'不存在"是否表示客户端和服务器版本不匹配?我找不到以后的PgAdmin版本.
在我的Spring MVC应用程序(servlet 3.0)中,我在web.xml中定义了一个自定义错误处理程序:
<error-page>
<location>/error</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)
映射到Controller:
@Controller
class CustomErrorController {
@RequestMapping("error")
public String customError(HttpServletRequest request, HttpServletResponse response, Model model) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
这适用于大多数错误,例如404错误.但是,我还定义了一个Interceptor,如果没有经过身份验证的用户,它会返回403响应:
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HttpSession httpSession = request.getSession();
((HttpServletResponse) response).setStatus(HttpURLConnection.HTTP_FORBIDDEN);
return false;
}
Run Code Online (Sandbox Code Playgroud)
自定义错误处理程序没有捕获403响应- 浏览器没有响应,错误代码为403.
我认为这是因为我在拦截器中做错了 - 我应该如何更改拦截器中的代码以便正常的错误处理工作?
我使用Spring的ApplicationListener接口实例化ScheduledExecutorService,如下所示:
@Component
public class ExecutorsStart implements ApplicationListener<ContextRefreshedEvent> {
private ScheduledExecutorService executor;
@Autowired
Scheduler scheduler;
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
executor = Executors.newSingleThreadScheduledExecutor();
scheduler.init();
int delay = 10;
int period = 60;// repeat every 1 minutes.
executor.scheduleAtFixedRate(scheduler, delay, period, TimeUnit.SECONDS);
}
Run Code Online (Sandbox Code Playgroud)
目前,当我运行./shutdown.sh时,Tomcat不会干净地关闭,并带有消息:
The web application [/foo] appears to have started a thread named [pool-1-thread-1] but has failed to stop it
Run Code Online (Sandbox Code Playgroud)
这似乎是因为我还没有编写代码来停止ScheduledExecutorService.
我的问题是:在这种环境下如何正确地完成这项工作?
我注意到存在ContextStoppedEvent,因此,我为它实现了一个监听器:
@Component
public class ExecutorsStop implements ApplicationListener<ContextStoppedEvent> {
@Autowired
ExecutorsStart executorsStart;
@Override
public void onApplicationEvent(final …Run Code Online (Sandbox Code Playgroud) 我正在使用SpringBoot的@Value注释从默认的application.properties文件填充对象属性,但是在Filter覆盖中看到一些奇怪的行为。
我的调试器中有两个断点:
@Component
public class BasicFilter implements Filter {
@Value("${aad.client_id}")
private String clientId;
@Bean
public FilterRegistrationBean registerFilter() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new BasicFilter()); // <-- 1.
registration.addUrlPatterns("/secure/*");
return registration;
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (request instanceof HttpServletRequest) { // <- 2.
HttpServletRequest httpRequest = (HttpServletRequest) request;
...
Run Code Online (Sandbox Code Playgroud)
在1 .: this.client_id处设置为'foo'(来自application.properties A2 2 .: this.client_id为空
对不同/缺失值有任何解释吗?
我希望以下内容返回所有元组,将层次结构中的每个父级解析到顶部,但它只返回最低级别(其ID在查询中指定).如何返回给定level_id的整个树?
create table level(
level_id int,
level_name text,
parent_level int);
insert into level values (197,'child',177), ( 177, 'parent', 3 ), ( 2, 'grandparent', null );
WITH RECURSIVE recursetree(level_id, levelparent) AS (
SELECT level_id, parent_level
FROM level
where level_id = 197
UNION ALL
SELECT t.level_id, t.parent_level
FROM level t, recursetree rt
WHERE rt.level_id = t.parent_level
)
SELECT * FROM recursetree;
Run Code Online (Sandbox Code Playgroud) 我有一个包含20列的Kendo UI网格,所有这些列都有文本数据。
当Kendo渲染网格时,每列(和列标题)都带有省略号(...),表示内容已被截断。
我在这里创建了一个示例:http : //dojo.telerik.com/iRIqU
网格宽度似乎适应了其所在容器的宽度-而不是强制显示所有数据并水平滚动所需的宽度。
有没有一种方法可以做到这一点,所以所有数据都是可读的?(即,格式>列>自动调整选择在Excel中的工作方式。)
我试过了
whitespace: nowrap;,但这只会导致文本重叠到每一列中gridto resizeable:true并进行调用,例如grid.autoFitColumn(1);-但所有这些都是减小列1的宽度以更好地容纳网格中的其他列我在数据库后端使用 Postgres 9.3 的报告中有以下相当简单的查询:
SELECT * FROM source
JOIN sourcelevel USING (source_id)
JOIN level USING (level_id)
WHERE
CASE WHEN isReportAdmin(1) THEN true
ELSE source_id in (SELECT source_id FROM sourceemployee WHERE employee = 1)
END
Run Code Online (Sandbox Code Playgroud)
我对 SQL 优化很陌生,我试图了解以下行为:
目前该isReportAdmin函数仅返回“true”
create or replace function isReportAdmin(employee_id integer) RETURNS bool AS $$
BEGIN
RETURN 't';
END;
$$ LANGUAGE plpgsql;
Run Code Online (Sandbox Code Playgroud)
当我运行报告查询时,大约需要两分钟来执行。
如果我简单地替换函数调用: CASE WHEN true THEN...
返回需要两秒钟。
你能解释一下,为什么函数调用会产生如此多的开销?在查询中处理此类函数是否有通用策略?
我正在编写 ASP .NET Core 3.1 应用程序,并且我想启用 Razor 运行时编译
当我尝试时
PM> Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
Run Code Online (Sandbox Code Playgroud)
我得到:
NU1608:检测到的包版本超出依赖性约束:Microsoft.CodeAnalysis.CSharp.Workspaces 2.8.0 需要 Microsoft.CodeAnalysis.CSharp (= 2.8.0),但版本 Microsoft.CodeAnalysis.CSharp 3.3.0 已解决。
我指定哪个“版本”似乎并不重要(尝试了几个)
如何解决这种依赖关系而不进一步陷入依赖地狱?
I've just logged onto our Prod box (Centos) after a long break, and I can't do git pull for some reason.
There seems to be a local problem with this clone of the repo, because I can clone and pull the same repo using the same credentials on other machines (that never had a clone of this repo before)
The command-line message is:
[root@ft41 project_folder]# git pull
Password:
error: while accessing https://<myusername>@bitbucket.org/<myproject>/<myrepo>.git/info/refs
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)
我已编辑了尖括号中的部分。这是info/refs该请求的常用网址吗?本地克隆中的某些内容可能会损坏并导致此情况吗?
如果有帮助: …
我一直在使用以下代码示例来测试从 Java 应用程序对 Microsoft Graph API 的访问:
https://azure.microsoft.com/en-au/resources/samples/active-directory-java-webapp-openidconnect/
在我的 Azure 门户中,我在 Azure Active Directory 下创建了一个注册应用程序。我已经进入API Access > Required Permissions并添加Microsoft Graph并检查了所有应用程序权限和委派权限。
当我尝试调用示例应用程序的“显示租户中的用户”功能时,我从 Microsoft 登录过程中收到以下错误消息:
AADSTS65005:资源无效。客户端请求访问未在客户端应用程序注册中请求的权限中列出的资源。客户端应用程序 ID:1b350134-84b1-4ca1-a181-03e3699996a1。请求中的资源值: https: //graph.windows.net。资源应用程序 ID:00000002-0000-0000-c000-000000000000。应用程序注册的有效资源列表:00000003-0000-0000-c000-000000000000。
谁能建议如何从这里继续?
active-directory azure azure-ad-graph-api microsoft-graph-api
我有一个 ExtJS 网格,它有一个用于(远程)分页的 PagingToolbar,以及一个定义为的复选框列:
{
dataIndex : 'selected',
xtype: 'checkcolumn',
width : 60
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我选中一个框然后向前和向后翻页,则不会保存复选框状态 - 所有复选框都未选中。
我想因为商店只包含当前页面的数据(来自服务器),我需要某种方式来存储不在当前数据页面中的行的状态,然后在我返回到该页面时恢复复选框。
是否有最佳实践或在分页时将复选框状态存储在商店中的示例?
我将concat在事件处理程序中使用的数组中添加几个项目,如下所示:
var selectedValues = [];
$.each($('#selected-levels').data("kendoListBox").dataSource.data(), function(i, item) {
selectedValues.concat([ item.id ])
});
return {
"selected" : selectedValues
};
Run Code Online (Sandbox Code Playgroud)
{level-selected: Array(0)}
即使我检查了中是否包含items,它始终会返回dataSource(通过调试器逐步完成)
为什么项目不出现在数组中?
java ×3
postgresql ×3
javascript ×2
spring ×2
sql ×2
asp.net-core ×1
azure ×1
c# ×1
checkbox ×1
css ×1
extjs ×1
git ×1
kendo-grid ×1
macos ×1
razor-pages ×1
servlet-3.0 ×1
spring-boot ×1
spring-mvc ×1
tomcat ×1
tomcat6 ×1