A short example below shows how comby simplifies matching and rewriting compared to regex approaches like sed
.
Need help writing patterns or have other problems? Post them in Gitter.
brew install comby
bash <(curl -sL get.comby.dev)
Other Linux distributions: The PCRE library is dynamically linked in the Ubuntu binary. For other distributions like Arch Linux, a fixup is needed: sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3
. On Fedora, use sudo ln -s /usr/lib64/libpcre.so /usr/lib64/libpcre.so.3
. Alternatively, consider building from source.
bash <(curl -sL get.comby.dev)
docker pull comby/comby
Running with docker on stdin
:
docker run -a stdin -a stdout -a stderr -i comby/comby '(:[emoji] hi)' 'bye :[emoji]' lisp -stdin <<< '(�� hi)'
Sometimes, yes. But often, small changes and refactorings are complicated by nested expressions, comments, or strings. Consider the following C-like snippet. Say the challenge is to rewrite the two if
conditions to the value 1
. Can you write a regular expression that matches the contents of the two if condition expressions, and only those two? Feel free to share your pattern with @rvtond on Twitter.
if (fgets(line, 128, file_pointer) == Null) // 1) if (...) returns 0
return 0;
...
if (scanf("%d) %d", &x, &y) == 2) // 2) if (scanf("%d) %d", &x, &y) == 2) returns 0
return 0;
To match these with comby, all you need to write is if (:[condition])
, and specify one flag that this language is C-like. The replacement is if (1)
. See the live example.
Install opam. TL;DR do sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
Run this if you don't have OCaml installed (it bootstraps the OCaml compiler):
opam init
opam switch create 4.11.0 4.11.0
Run eval $(opam env)
Install OS dependencies:
Linux: sudo apt-get install autoconf libpcre3-dev pkg-config zlib1g-dev m4 libgmp-dev libev-dev libsqlite3-dev
Mac: brew install pkg-config gmp pcre libev
Then install the library dependencies:
git clone https://github.com/comby-tools/comby
cd comby
opam install . --deps-only
make
make test
comby
on your PATH
by runningmake install
解决fasterxml中string字符串转对象json格式错误问题。 springboot中jackson使用的包是fasterxml的。可以通过如下代码,将一个形如json格式string转为一个java对象: com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.Obje
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field “dnsMonitoring” 1、UnrecognizedPropertyException 无法识别的属性异常 UnrecognizedPropertyException 无法识别的属性异常 是因为JSO
如果我的博客能够帮到大家能够点个赞,关注一下,以后还会更新更过JavaWeb的高级技术,大家的支持就是我继续更新的动力。谢谢。 今天在使用SpringBoot 链接数据库,测试得时候出现了以下错误: Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The s
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.ArrayList out of VALUE_STRING token 原因: 页面传参json数组字符串,导致后台spring无法解析,例如:[{“name”: “1”},
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: The last packet successfully received from the server was 35,813 milliseconds ago. The last packet sent successfully to the server was 35,
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsExcept
当使用Nacos作为服务注册中心以及配置中心时,分别引用注册和配置l依赖 <!-- 服务注册/发现--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</
> Task :app:mergeDexDebug FAILED AGPBI: {"kind":"error","text":"Cannot fit requested classes in a single dex file (# methods: 96574 > 65536)","sources":[{}],"tool":"D8"} com.android.builder.dexing.Dex
Java8的groupingBy实现集合的分组,类似Mysql的group by分组功能,注意得到的是一个map 对集合按照单个属性分组、分组计数、排序 List<String> items = Arrays.asList("apple", "apple", "banana", "apple", "orange", "banana", "papa
mybatis使用jdbc连接sqlserver数据时,抛出如下异常。 异常的大概意思:目前使用的驱动程序不支持SQLServer版本8 查看了引入的jar包是这个"mssql-jdbc.jar"所以才导致异常的出现,之后换成"sqljdbc4.jar" 就解决了 注意:sqljdbc4.jar 必须要在jdk1.6以上的版本才能使用,sqljdbc4.jar 点击下载 2018-07-11 11
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.ArrayList out of VALUE_STRING token 原因: 页面传参json数组字符串,导致后台spring无法解析,例如:[{“name”: “1”},
错误信息: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'plmpermiss0_.created_user_psn_code' in 'field list' at sun.reflect.NativeConstructorAccessorImpl.newInstanc
直接在连接的后面添加useSSL=false 如下: url: jdbc:mysql://192.168.56.10:3306/gulimall_admin?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
使用AS打包时,出现下面的错误,在AndroidManifest.xml文件中的第53行出现了错误,如下图: 2、发现在第53行是一个自定义的app访问权限,定睛一看,上面的注释(即//自定义app访问权限)的注释方式不对,在xml中应该使用<!---->进行注释,将注释部分改为“<!--自定义appp访问权限-->”后,重新打包即可!
配置的问题 1 jdbc 得版本问题 2 数据库加时区 3 dataSource数据源加?serverTimezone=UTC