这篇文章是继我之前关于git pull的帖子之后的:Git:“ git pull”到底有什么作用?
假设我要对某个分支进行“ git pull”操作,并且希望该分支的本地副本与远程分支的远程副本相同。怎么做?
我是React的新手,我用以下解释来构建基本的React应用程序:https : //facebook.github.io/react/docs/installation.html
我通过以下方式打开了一个新项目:
npm install -g create-react-app
create-react-app my-app
cd my-app
npm start
Run Code Online (Sandbox Code Playgroud)
index.html文件位于hello-world / public中,其内容是:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是,所有“反应材料”都放在hello-world \ src目录中。看起来“ hello-world \ src \ index.js”激活了这些组件。
我不明白的是index.html如何“读取” index.js的内容。index.html没有指向index.js的html标记。
我可以通过“ npm start”启动该应用程序。该命令的作用是提高运行在localhost:3000上的服务器。不使用“ npm start”如何查看应用程序?
我是 VSCode 的新手,我用它来调试 node.js(Typescript) 代码。我注意到的一点是,如果我的代码在断点处停止,然后我使用选项“Step Over”或“Step Into”,代码将转到编译后的 Javascript 文件,而不是相关的 Typescript 文件。
您知道如何使调试器仅通过使用“Step into”/“Step over”来处理 Typescript 文件吗?
我的 settings.json 文件看起来像这样:
{
"type": "node2",
"request": "launch",
"name": "Launch TS Program",
"program": "${workspaceFolder}\\app.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}\\**\\*.js"
],
"smartStep": true,
"outputCapture": "std",
"console": "internalConsole",
},
Run Code Online (Sandbox Code Playgroud) 我希望描述以下场景:我有一个 Node.js 后端应用程序(它使用单线程事件循环)。这是系统的总体架构:Producer -> Kafka -> Consumer -> Database
假设生产者向 Kafka 发送一条消息,该消息的目的是在数据库中进行某个查询并检索查询结果。然而,众所周知,Kafka是一个异步系统。如果生产者向 Kafka 发送一条消息,它会收到一条响应,表明该消息已被 Kafka 代理接受。Kafka 代理不会等到消费者轮询消息并处理它。
那么生产者如何获取对数据库操作的查询结果呢?
假设我们有一个类 A 和一个从类 A 继承的类 B。假设我们有:
Set<A> setOfAs = new HashSet<>();
Run Code Online (Sandbox Code Playgroud)
以下铸造:
((Set<B>) setOfAs)
Run Code Online (Sandbox Code Playgroud)
会给我们运行时错误。
但是,如果我们使用通配符并定义以下集合:
Set<? extends A> setOfAs = new HashSet<>();
Run Code Online (Sandbox Code Playgroud)
我们没有问题进行铸造:
((Set<B>) setOfAs)
Run Code Online (Sandbox Code Playgroud)
为什么允许转换通配符集合,而禁止转换“常规”类型的集合?
我对 IntelliJ 的这个很棒的功能还很陌生。当我运行代码覆盖率时,我可以在 IDE 中看到绿色标记表示该行是否被覆盖,红色标记表示该行是否未被覆盖。这很棒。但我想看看涵盖这些行的单元测试是什么。
当我单击绿色标记时,我只看到点击数:
你知道怎么看吗?
我对 JetBrains IDE(PyCharm、WebStorm、IntelliJ ..)中的调试模式有疑问。假设我在代码中有一行看起来像这样:
....func1()...func2()...func3()...
在同一行中调用了多个functinos,并且没有将它们分配给变量。现在,我想知道每个函数的返回值是什么。我知道 Evaluate Expression 功能,但我不想使用它,因为它可能会再次调用这些函数。
你知道有什么方法可以找到一个函数的返回值而不用将它的值赋给一个变量并在调试器中检查它的值吗?
我读了这篇文章: Java 中 Arrays.asList(array) 与 new ArrayList<Integer>(Arrays.asList(ia)) 的区别
我有一个问题。我看看这条线:
List<Integer> list2 = Arrays.asList(ia)
Run Code Online (Sandbox Code Playgroud)
仍然有一行说:
当然,有些 List 操作是不允许在 wrapper 上进行的,比如在列表中添加或删除元素,你只能读取或覆盖元素。
如果 list2 有 List 接口的引用,我希望它在 Java 中实现 List 接口中包含的所有方法。https://docs.oracle.com/javase/7/docs/api/java/util/List.html。
添加(整数索引,E 元素)
和
删除(整数索引)
显示在 List 接口中,那么它们怎么可能没有在 list2 中实现呢?
我原以为这list2是一个List;因此我可以调用属于 List 接口的所有方法?!那么为什么在调用add()or时会抛出异常remove()呢?
这是我的 pom.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SpringBootGame</groupId>
<artifactId>SpringBootGame</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.3.RELEASE</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.game.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
我通过“mvn clean install”构建我的jar文件,然后运行通过“java -jar target\SpringBootGame-1.0-SNAPSHOT.jar”提取的jar文件。
然后,我收到一个错误:
线程“main”中的异常 java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication at com.game.Main.main(Main.java:15) 引起的:java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication在 java.net.URLClassLoader.findClass(Unknown Source) …
根据此链接,属性 server.tomcat.max-connections 和 server.tomcat.max-threads 确定应用程序中的最大连接数和最大线程数。
我有两个问题:
如果在给定时刻连接数超过线程数会发生什么?没有得到线程的连接会发生什么?
如果服务器必须处理比 server.tomcat.max-connections 多的请求,会发生什么?它会忽略在线程连接数达到最大值后到达的请求吗?
java ×3
spring-boot ×2
apache-kafka ×1
collections ×1
git ×1
maven ×1
pycharm ×1
reactjs ×1
tomcat ×1
typescript ×1
webstorm ×1