小编Sil*_*eri的帖子

在Psql输出中禁用包装

在Linux中使用Psql时,如果我的SQL查询的结果包含许多列或长数据字符串,它将包装初始视图,只有当我滚动到侧面时它才会停止换行并在单独的行上显示每一行.

我已经尝试了各种\pset方案,如format unaligned,format aligned,format wrapped,columns 0,columns 1000,但似乎没有一个完全停止包装,除非我生成静态输出到文件.

如何将其设置为永不包装输出,同时仍然可滚动并使用默认的ascii表格式显示结果?

postgresql bash psql

28
推荐指数
5
解决办法
9714
查看次数

Jetty:将HTTP重定向到HTTPS以获取静态内容

我已经使用两个XML上下文配置设置了Jetty 9.3.一个用于静态内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
  <Set name="contextPath">/static</Set>
  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.ResourceHandler">
      <Set name="resourceBase">/home/user/static</Set>
      <Set name="directoriesListed">true</Set>
    </New>
  </Set>
</Configure>
Run Code Online (Sandbox Code Playgroud)

一个用于Web应用程序(WAR文件):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/webapp</Set>
  <Set name="war">/home/user/webapp.war</Set>
</Configure>
Run Code Online (Sandbox Code Playgroud)

然后,我使用此答案设置Jetty以将HTTP请求转发到HTTPS.更具体地说,我将以下内容添加到jetty/etc/webdefault.xml:

<security-constraint>
  <web-resource-collection>
   <web-resource-name>Everything</web-resource-name>
   <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <user-data-constraint>
   <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)

并将以下内容添加到我的HttpConfigurationjetty/etc/jetty.xml:

<Call name="addCustomizer">
  <Arg>
    <New class="org.eclipse.jetty.server.SecureRequestCustomizer" />
  </Arg>
</Call>
Run Code Online (Sandbox Code Playgroud)

这适用于我的Web应用程序(即通过'/ webapp'上的HTTP访问服务器将重定向到HTTPS),但似乎不会影响'/ static'下提供的静态内容.我认为这是因为添加的设置webdefault.xml仅适用于Web应用程序,因为它们具有适用的web.xml文件.

如何为我作为静态内容的所有网页设置HTTP请求以重定向到HTTPS?

java xml jetty jetty-9

13
推荐指数
1
解决办法
1122
查看次数

将localhost添加到内容安全策略是不安全的吗?

meta在我的标签中设置了以下标签index.html,简化了本地开发,但也将部署在生产代码中:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' localhost:* ws://localhost:*;">
Run Code Online (Sandbox Code Playgroud)

有没有任何已知的方法,这样添加localhost可以允许任何类型的跨站点脚本攻击?

谷歌的CSP评估员说,似乎没关系(好吧,localhost至少部分).

html xss localhost content-security-policy

9
推荐指数
1
解决办法
5050
查看次数

为Eclipse项目设置日志记录配置文件

要指定我的日志记录配置文件,我当前需要为当前Eclipse项目中的每个运行配置单独设置VM参数:

-Djava.util.logging.config.file=src/main/resources/logging.properties
Run Code Online (Sandbox Code Playgroud)

我知道我也可以通过转到全局为工作区设置它

Window -> Preferences -> Java / Installed JREs,
Run Code Online (Sandbox Code Playgroud)

选择适当的JRE,单击"编辑..."并将该行添加到"默认VM参数"字段.

但是可以将其设置为每个项目的默认值(而不是工作空间或运行配置)吗?

java eclipse logging eclipse-juno

6
推荐指数
1
解决办法
6066
查看次数

将 Angular 组件注入 FullCalendar 事件条目

PrimeNG 7引入了一个<p-fullCalendar>FullCalendar 4.0库包装为 Angular 组件的组件。例如

<p-fullCalendar [options]="options" [events]="events"></p-fullCalendar>
Run Code Online (Sandbox Code Playgroud)

FullCalendar 选项包括eventRender选项以指定一个函数来自定义事件在日历中的呈现方式。我在下面的示例中使用了它,但它使用标准 Javascript生成DOM 元素,因此不能包含任何其他 Angular 组件,例如示例中的 Material design-styled 按钮(它仍然创建一个基本的无样式按钮,因为标准<button>用来)。

我曾尝试研究诸如使用 Angular 的[innerHTML], ViewContainerRefwithComponentFactoryResolver或 Angular 的运行时 JIT 编译器之类的选项,但我不太了解这些方法中的任何一种,或者不知道哪种方法最适合这个用例。如何将 Angular 组件注入 FullCalendar 事件条目?

它不需要是完全动态的,例如,隐藏组件已经存在于页面上但显示在正确的位置,或者ng-templates只是以不同的方式实例化可能没问题,只要它显示并像一个正确的条目一样工作在日历上。

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-calendar',
  templateUrl: './calendar.component.html',
  styleUrls: ['./calendar.component.scss']
})
export class CalendarComponent implements OnInit {

  options: any;
  events: any[];

  constructor() { }

  ngOnInit() …
Run Code Online (Sandbox Code Playgroud)

fullcalendar primeng angular

5
推荐指数
1
解决办法
1124
查看次数