Runner

能让你开发效率翻倍的 VSCode 插件配置

梦想的初衷 提交于 2019-11-30 12:24:39
工欲善其事必先利其器,软件工程师每天打交道最多的可能就是编辑器了。入行几年来,先后折腾过的编辑器有 EditPlus、UltraEdit、Visual Studio、EClipse、WebStorm、Vim、SublimeText、Atom、VSCode,现在仍高频使用的就是 [VSCode]和 [Vim]了。实际上我在 VSCode 里面安装了 Vim 插件,用 Vim 的按键模式编码,因为自从发现双手不离键盘带来的效率提升之后,就尽可能的不去摸鼠标。 折腾过 Atom 的我,首次试用 VSCode 就有种 Vim 的轻量感,试用之后果断弃坑 Atom。Atom 之前,我还使用过 SublimeText,但它在保存文件时会不时弹出购买授权的弹窗,实在是令人烦恼。 每每上手新的编辑器,我都会根据自己的开发习惯把它调较到理想状态,加上熟悉编辑器各种特性,这个过程通常需要几周的时间。接下来,我就从外观配置、风格检查、编码效率、功能增强等 4 方面来侃侃怎么配置 VSCode 来提高工作幸福感。 外观配置 外观是最先考虑的部分,从配置的角度,无非是配色、图标、字体等,俗话说萝卜白菜各有所爱,我目前的配色、图标、字体从下图基本都能看出来,供大家参考: ![] 配色:[Solarized Dark],VSCode 已经内置,使用了至少 5 年以上的主题,Vim 下的配置完全相同; 图标:

Runner in Ruby on Rails

 ̄綄美尐妖づ 提交于 2019-11-30 08:01:59
What is script/runner? What is a runner? How do I use runner on a Ruby file? What are all the commands typed out on the command prompt? I'm using Windows by the way. From the Rails Guides : 1.7 rails runner runner runs Ruby code in the context of Rails non-interactively. For instance: $ rails runner "Model.long_running_method" You can also use the alias “r” to invoke the runner: rails r . You can specify the environment in which the runner command should operate using the -e switch. $ rails runner -e staging "Model.long_running_method" Any code to be run must be loaded as a part of your Rails

java中的线程

独自空忆成欢 提交于 2019-11-30 07:57:36
java语言里的线程本质上就是操作系统的线程,他们是一 一对应的 线程生命周期 线程状态转换图—— 五态模型 初始状态: 线程已经被创建,但是还没有分配CPU执行。 这个状态属于编程语言特有的,不过这里所谓的被创建,仅仅时在编程语言层面被创建,而在操作系统层面,真正的线程还没创建。 可运行状态:初始状态线程执行start()方法,线程具备CPU的执行资格,没有CPU的执行权。 这种状态下,真正的操作系统线程已经被成功创建了,所以可以分配CPU执行了。 运行状态: 处于可运行状态的线程得到CUP执行权。 当有空闲的CPU时,操作系统会将其分配给一个处于可运行状态的线程,被分配到CPU的线程状态就转换成了运行状态。 休眠状态:运行状态的线程释放CPU的执行权。 运行状态的线程如果调用一个阻塞的API(sleep,wait)或者等待某个事件(例如条件变量),那么线程的状态就会转换到休眠状态,同时释放CPU使用权,休眠状态的线程永远没有机会获得 CPU使用权。当等待的事件出现了(sleep到期,wait执行notif),线程就会从休眠状态转换到可运行状态。 终止状态: 线程执行完或者出现异常或者调用API强制结束。 java中的线程周期 Java语言中线程共有六种状态,分别是: NEW(初始化状态) : Java刚创建出来的Thread对象。 RUNNABLE(可运行/运行状态) :

多线程-AQS-CountDownLatch

南笙酒味 提交于 2019-11-29 23:19:24
介绍: CountDownLatch--发令枪 Java1.5之后引入的Java并发工具类,谈到CountDownLatch需要先介绍一个概念:闭锁/门栓[latch] latch:一种同步方法,可以延迟线程的进度直到线程到达某个终点状态。闭锁的状态是一次性的,它确保在闭锁打开之前所有特定的活动都需要在闭锁打开之后才能完成。 如若掌握了AQS的实现原理,这里的理解将会更加的水到渠成 ==========================分割线========================== 应用场景 A:如同赛跑,必须等待发令枪响后runner才能起跑一样,在CountDownLatch的计数器归零前,所有引用CountDownLatch闭锁的线程都必须阻塞。总结:准备好了才开始 B:如同购物,只有所有商品都确定购买了才好结账,在所有任务执行完[并进行countDown()]直到归零前,当前任务必须阻塞。总结:准备好了才结束 应用A的样例[准备好了才开始]: import java.util.concurrent.CountDownLatch; /** * Created by ysma on 2018/6/7. */ public class Test { public static void main(String[] args) throws

what does gulp-“cli” stands for?

蹲街弑〆低调 提交于 2019-11-29 21:24:58
Can someone please explain what exactly are the differences between the following two methods of gulp installation: $ npm install --global gulp-cli and $ sudo npm install -g gulp It looks to me that both do the same thing except that the first method gives me a version 1.2.1, and the later gives me version 3.9.1 Can someone put into simple terms what exactly are the differences? and plus what is "cli" stands for? N. Brun The goal of gulp-cli is to let you use gulp like a global program, but without installing gulp globally. For example if you installed gulp 3.9.1 globally and your project

Runner in Ruby on Rails

我怕爱的太早我们不能终老 提交于 2019-11-29 10:55:31
问题 What is script/runner? What is a runner? How do I use runner on a Ruby file? What are all the commands typed out on the command prompt? I'm using Windows by the way. 回答1: From the Rails Guides: 1.7 rails runner runner runs Ruby code in the context of Rails non-interactively. For instance: $ rails runner "Model.long_running_method" You can also use the alias “r” to invoke the runner: rails r . You can specify the environment in which the runner command should operate using the -e switch. $

springBoot启动时,选择可执行的任务

蹲街弑〆低调 提交于 2019-11-29 06:44:07
一次。。有人问我:“boot 启动时 如果想要执行一些任务怎么做?” 我特二的回答。放在spring auto 启动配置项里面 然后在spring容器启动的时候注入。或者使用动态代理。做切面。 虽然上述方式貌似可以执行。但有点复杂。其实boot提供了一种启动后就做的任务操作。 CommandLineRunner 看源码说明为: Spring Batch jobs. Runs all jobs in the surrounding context by default. Can also be used to launch a specific job by providing a jobName。 即,在spring容器启动的时候就开始批处理一些任务。是随spring启动而加载运行的。 使用方式:自定义一个model 实现该及接口并重写run 方法 package org.springboot.sample.runner; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component public class MyStartupRunner implements CommandLineRunner { @Override

what does gulp-“cli” stands for?

谁说胖子不能爱 提交于 2019-11-28 17:06:35
问题 Can someone please explain what exactly are the differences between the following two methods of gulp installation: $ npm install --global gulp-cli and $ sudo npm install -g gulp It looks to me that both do the same thing except that the first method gives me a version 1.2.1, and the later gives me version 3.9.1 Can someone put into simple terms what exactly are the differences? and plus what is "cli" stands for? 回答1: The goal of gulp-cli is to let you use gulp like a global program, but

涨姿势:Spring Boot 2.x 启动全过程源码分析

落爺英雄遲暮 提交于 2019-11-28 15:45:59
上篇《 Spring Boot 2.x 启动全过程源码分析(一)入口类剖析 》我们分析了 Spring Boot 入口类 SpringApplication 的源码,并知道了其构造原理,这篇我们继续往下面分析其核心 run 方法。 [toc] SpringApplication 实例 run 方法运行过程 上面分析了 SpringApplication 实例对象构造方法初始化过程,下面继续来看下这个 SpringApplication 对象的 run 方法的源码和运行流程。 public ConfigurableApplicationContext run(String... args) { // 1、创建并启动计时监控类 StopWatch stopWatch = new StopWatch(); stopWatch.start(); // 2、初始化应用上下文和异常报告集合 ConfigurableApplicationContext context = null; Collection<SpringBootExceptionReporter> exceptionReporters = new ArrayList<>(); // 3、设置系统属性 `java.awt.headless` 的值,默认值为:true configureHeadlessProperty(); // 4

本地搭建的GitLab中开启Pages功能,不需要域名也可以

纵然是瞬间 提交于 2019-11-28 12:22:32
最近在公司内部,我负责搭建了GitLab服务,开启了从SVN逐步转到GIT的路程。目前自建的GitLab运行状态良好,非常好用。但是默认的GitLab并没有开启Pages服务,这样的话在编写项目说明文档时,就很不方便了。于是自己试着在本地搭建的GitLab中开启Pages功能,下面把开启过程和遇到的问题记录下来,分享给大家。 1、开启GitLab Pages功能 编辑 /etc/gitlab/gitlab.rb文件,修改如下两行 ##! Define to enable GitLab Pages pages_external_url "http://R7102/" gitlab_pages['enable'] = true 注意的这里的pages_external_url,配置的是Pages使用的域名。如果你没有域名,就先随便写个主机名什么的。之后我们可能通过配置Nginx来解决。 ※注意,最好通过 gitlab-ctl restart 重启GitLab,使得GitLab Pages功能生效。 2、安装配置GitLab Runner 为了能够自动发布Pages,我们需要安装GitLab Runner,然后通过GitLab CI做到Pages内容的自动更新。 由于网络环境不稳定,所以建议不要使用yum方式安装Runner,可以点击下面的链接下载GitLab Runner的安装包。