Here

bash中的“ cat << EOF”如何工作?

情到浓时终转凉″ 提交于 2020-02-26 07:28:27
我需要编写脚本以将多行输入输入到程序( psql )。 经过一番谷歌搜索,我发现以下语法有效: cat << EOF | psql ---params BEGIN; `pg_dump ----something` update table .... statement ...; END; EOF 这样可以正确构造多行字符串(从 BEGIN; 到 END; ,包括两端),并将其作为输入传递给 psql 。 但是我不知道它如何/为什么起作用,请解释一下吗? 我主要是指 cat << EOF ,我知道 > 输出到文件, >> 追加到文件, < 从文件读取输入。 << 到底是做什么的? 并且有手册页吗? #1楼 当在Bash中处理多行文本时, cat <<EOF 语法非常有用。 将多行字符串分配给shell变量,文件或管道时。 Bash中 cat <<EOF 语法用法的示例: 1.将多行字符串分配给shell变量 $ sql=$(cat <<EOF SELECT foo, bar FROM db WHERE foo='baz' EOF ) 现在, $sql 变量也包含换行符。 您可以使用 echo -e "$sql" 进行验证。 2.将多行字符串传递到Bash中的文件 $ cat <<EOF > print.sh #!/bin/bash echo \$PWD echo $PWD EOF

PHP 7.4 有什么新特性功能?

你说的曾经没有我的故事 提交于 2020-02-26 01:06:11
PHP 7.4, the last version before PHP 8, brings lots of new features, syntax additions and fixes. It was be released on November 28, 2019. In this post you'll find a list with everything that's new and changed to help you prepare for the upgrade. Let's start though with a few highlights, included in PHP 7.4: Arrow functions for cleaner one-liner functions Preloading to improve performance Typed properties in classes Improved type variance The null coalescing assignment operator as a shorthand FFI for better extension development in PHP Underscores can be used to format numeric values Spread

Intro to Spring Boot Starters

左心房为你撑大大i 提交于 2020-02-25 22:12:44
1. Overview Dependency management is a critical aspects of any complex project. And doing this manually is less than ideal; the more time you spent on it the less time you have on the other important aspects of the project. Spring Boot starters were built to address exactly this problem. Starter POMs are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy-paste loads of dependency descriptors. We have more than 30 Boot starters

vscode 远程调试

梦想的初衷 提交于 2020-02-25 20:59:45
1. SSH 安装兼容 OpenSSH 的 SSH 客户端Windows, 安装 Git for Windows 即可,https://git-scm.com/download/win win安装ssh服务端 freesshd https://blog.csdn.net/qq_36249516/article/details/77987144?utm_source=blogxgwz9 2.插件 Remote Development扩展,只用安装这个插件,其他的依赖包会自动下载。 打开命令行,并输入 ssh 字样,按照下图中第二步选择 Remote-SSH:Connet to Host... 输入连接到远程主机的用户名和 ip 连接成功后会另外再打开一个新的窗口 右下角 打开后,visual studio code会自动在远程PC上,安装配置 要root权限 二、保存经常连接的主机信息 Host root@192.168.1.100 #因为bug HOST必须这样写 User root HostName 192.168.1.100 # Port 自定义端口22 Host example-remote-linux-machine-with-identity-file User your-user-name-on-host HostName another-host-fqdn-or-ip

A (Mostly) Complete Guide to the WordPress Rewrite API

拈花ヽ惹草 提交于 2020-01-09 14:06:05
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> The WordPress , Rewrite API is like a mythical creature. Not many know it exists, and few still know how to tame it. In this article, we’ll cover the basics of the Rewrite API and how to make it work for you. The Rewrite API includes three commonly used functions (and a fourth function that doesn’t get much love). add_rewrite_rule add_rewrite_tag add_rewrite_endpoint add_feed – Not incredibly useful, generally, but it could be! How WordPress Permalinks Work When you request a page on a WordPress site, assuming it’s using pretty permalinks, the rules in

递归实现:合并两个有序列表l1,l2,合并之后仍然有序;

两盒软妹~` 提交于 2020-01-07 12:35:26
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 合并两个有序列表 l1,l2 ,合并之后仍然有序; 合并过程: 1. 如果链表 l1 为空,返回 L2 作为结果,;如果 l2 为空,返回 L1 作为结果 2. L1 的头节点的值小于链表 2 的头节点的值,将 l1 的头节点作为合并后链表的头节点 3. 继续比较两个链表节点的值,将较小的节点作为已经合并链表的下一个节点; 4. 递归调用,查找合并链表的下一个节点 public ListNode mergeTwoLists(ListNode l1 , ListNode l2 ) { // write your code here if ( l1 == null ) { return l2 ; } if ( l2 == null ) { return l1 ; } ListNode list = null ; if ( l1 . val < l2 . val ) { list = l1 ; list . next = mergeTwoLists( l1 . next , l2 ); } else { list = l2 ; list . next = mergeTwoLists( l1 , l2 . next ); } return list ; } 来源: oschina 链接: https://my

Redis 6.0 新特性之集群代理

我的未来我决定 提交于 2020-01-07 12:09:33
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Redis 6.0 release notes ======================= Upgrade urgency LOW: This is the first RC of Redis 6. Introduction to the Redis 6 release =================================== Redis 6 improves Redis in a number of key areas and is one of the largest Redis releases in the history of the project, so here we'll list only the biggest features in this release: * A Redis Cluster proxy was released here: https://github.com/artix75/redis-cluster-proxy 集群代理 上文 redis 6.0 发版日志,新增 redis cluster proxy 模块。 在 Redis 集群中,客户端会非常分散,现在为此引入了一个集群代理,可以为客户端抽象 Redis 群集

Python 调试方法

你说的曾经没有我的故事 提交于 2019-12-27 16:12:24
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的 脚本 语言。 1、print print('here') # 可以发现某段逻辑是否执行 # 打印出变量的内容 最简单 print() 只是影响代码美观,而且需要在后面删掉,比较麻烦 断言 凡是用print来辅助查看的地方,都可以用断言(assert)来替代: # err.py def foo(s): n = int(s) assert n != 0, 'n is zero!' return 10 / n def main(): foo('0') 2、assert assert false, 'blabla' # 如果条件不成立,则打印出 'blabla' 并抛出AssertionError异常 assert 语句的作用是:当条件表达式的值为真时,该语句什么也不做,程序正常运行;反之,若条件表达式的值为假,则 assert 会抛出 AssertionError 异常。其中,[,描述信息] 作为可选参数,用于对条件表达式可能产生的异常进行描述。 例如: s_age = input("请输入您的年龄:") age = int(s_age) assert 20 < age < 80 , "年龄不在 20-80 之间" print(

在javsscript中动态创建qml组件

霸气de小男生 提交于 2019-12-25 15:43:24
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Dynamic QML Object Creation from JavaScript QML supports the dynamic creation of objects from within JavaScript. This is useful to delay instantiation of objects until necessary, thereby improving application startup time. It also allows visual objects to be dynamically created and added to the scene in reaction to user input or other events. See the Dynamic Scene example for a demonstration of the concepts discussed on this page. Creating Objects Dynamically There are two ways to create objects dynamically from JavaScript. You can either call Qt

004. 线程安全之可见性问题

橙三吉。 提交于 2019-12-25 13:14:29
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1. Java 内存内存模型 vs JVM 运行时数据区 2. 初看 Java 内存模型 多线程程序语义:当多个线程修改了共享内存中的值时,应该读取到哪个值的规则。这些语义没有规定如何执行多线程程序,相反,他们描述了允许多线程程序的合法行为。 说白了,Java 内存模型实际上描述的是 Java 语言在执行多线程程序时的一些规则。 3. 多线程中的问题 所见非所得 无法肉眼去检测程序的准确性 不同的运行平台有不同的表现 错误很难重现 public class Demo10 { int i = 0; boolean isRunning = true; public static void main(String[] args) throws InterruptedException { Demo10 demo = new Demo10(); new Thread(() -> { System.out.println("here i am ..."); while (demo.isRunning) { demo.i++; } System.out.println(demo.i); }).start(); Thread.sleep(3000); demo.isRunning = false; System.out