在下面的代码中,
document.documentElement.clientWidth
1349
document.documentElement.clientHeight
363
window.innerWidth
1366
window.innerHeight
363
window.screen.height
768
window.screen.width
1366
Run Code Online (Sandbox Code Playgroud)
所以,我的桌面屏幕宽1366像素,高768像素.
我了解到,
视口尺寸使用document.documentElement.clientWidth
和引用document.documentElement.clientHeight
.
窗口尺寸使用window.innerWidth
和引用window.innerHeight
.
1)视口和文档有什么区别?
2)window.onload
Vsdocument.onload
什么时候被调用?
读取查询
在Posgres中,全文索引允许对文档进行预处理并保存索引以供以后快速搜索.预处理包括:
将文档解析为标记.
将标记转换为词位.
存储为搜索而优化的预处理文档.
tsvector
在Postgres中使用type进行全文搜索
tsvector
类型与text
下面的类型不同:
消除案件.大写/小写字母相同
删除停用词(和,或者,不是,她,他和其他数百个) - 因为这些词与文本搜索无关
替换同义词并取词干(elephant
- > eleph
).在全文目录中,它没有单词elephant
而是单词elep
.
可以(并且应该)使用GIST和GIN编制索引
自定义排名与权重和 ts_rank
弹性搜索(搜索引擎)如何优于Postgres中的全文搜索?
postgresql indexing full-text-search object-oriented-database elasticsearch
下面是一个为学习而编写的简单servlet.
package com.example.tutorial;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ServletExample extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello Java!");
}
}
Run Code Online (Sandbox Code Playgroud)
当浏览器访问这个网址:http://localhost:8081/ServletsJSPExample/servletexample
,
通过分析http数据包的请求头,它显示了GET
从浏览器发送的请求.但是,在我的servlet中,我没有GET
处理请求.
所以,
当没有service
方法被调用?
为什么service
方法会收到此GET
请求?
在java中,
有整数类型(char
/ short
/ int
/ long
/ byte
)
有浮动类型(float
/ double
)
boolean
与C语言不同,有布尔类型(),而不是整数类型.
问题1)
是否有一个通用规则用于转换(根据JLS)会话,哪种类型可以转换为另一种类型?出于常识,我知道,boolean
不允许使用积分和浮动类型
问题2)
请帮我理解以下输出的原因:
/*
* Casting rules for primitive types
*/
double aDoubleValue = 30000000000000000000.123438934;
int doubleToInt = (int)aDoubleValue; //stores max value 2147483647, makes sense!!
byte doubleToByte = (byte)aDoubleValue; //stores -1, why not 127?
short doubleToShort = (short)aDoubleValue; // stores -1, why not 32767?
long doubleToLong = (long)aDoubleValue; // stores 9223372036854775807, makes sense!!
float doubleToFloat = (float)aDoubleValue; // …
Run Code Online (Sandbox Code Playgroud) 下面是定义枚举类型的代码.
enum Company{
EBAY(30), PAYPAL(10), GOOGLE(15), YAHOO(20), ATT(25);
private int value;
private Company(int value){
super(this.name());
this.value = value;
}
public int getValue(){
return value;
}
}
Run Code Online (Sandbox Code Playgroud)
内部编译到,
final class Company extends Enum<Company>{
public final static Company EBAY = new Company(30);
public final static Company PAYPAL = new Company(10);
public final static Company GOOGLE = new Company(15);
public final static Company YAHOO = new Company(20);
public final static Company ATT = new Company(25);
private int value;
private Company(int value){
super(this.name(),Enum.valueOf(Company.class, this.name())); …
Run Code Online (Sandbox Code Playgroud) 调用方法后,
node.nth(5)
Run Code Online (Sandbox Code Playgroud)
在下面的代码中,
public class List_Node {
int item;
List_Node next;
public List_Node() {
this.item = 0;
this.next = null;
}
public List_Node(int item, List_Node next) {
this.item = item;
this.next = next;
}
public List_Node(int item) {
this(item, null);
}
public void insertAfter(int item) {
this.next = new List_Node(item, this.next);
}
public List_Node nth(int position) {
if (position == 1) {
return this;
} else if((position < 1) || (this.next == null)) {
/* error checking */
return null; …
Run Code Online (Sandbox Code Playgroud) var sym = Symbol();
Run Code Online (Sandbox Code Playgroud)
是window['sym']
这已经是全球范围.
但是MDN说:
使用该
Symbol()
函数的上述语法不会创建整个代码库中可用的全局符号.要创建跨文件和类似全局范围的环境中可用的符号,请使用这些方法Symbol.for()
并Symbol.keyFor()
从全局符号注册表中设置和检索符号.
sym
已经在浏览器的全局范围内,具有上述声明语法.
什么是全球符号注册表?
每个html文档都与window
对象绑定.
那么,在浏览器世界中,跨文件/领域的符号可用性范围与全局范围(对象)有何不同window
?
Docker容器的主要目的是避免在每个容器中都携带guest OS,如下所示。
正如这里提到的,该
FROM
指令初始化一个新的构建阶段并为后续指令设置基础镜像。因此,有效的 Dockerfile 必须以FROM
指令开头。
我的理解是,FROM <image>
允许容器在其自己的操作系统上运行。
为什么一个有效的 Docker 文件必须有FROM
指令?
有一个kafka主题有16个分区
使用给定的消费者组名称,我们目前正在启动单个消费者来读取该主题。
单个消费者是否partition 0
(仅)阅读该主题?如果partition 0
消息已空,消费者是否开始从下一个分区读取(partiton 1
...等等)?
我们可以选择启动多个消费者(具有相同的消费者组名称)来读取同一主题(具有 16 个分区)。可以维护多少个消费者来并行读取多个分区?
java ×4
javascript ×2
apache-kafka ×1
casting ×1
css ×1
docker ×1
dockerfile ×1
dom ×1
ecmascript-6 ×1
enumeration ×1
enums ×1
html ×1
indexing ×1
java-8 ×1
kafka-topic ×1
postgresql ×1
prometheus ×1
promql ×1
recursion ×1
servlets ×1
symbols ×1