enjoy coding, enjoy life.

Code

Gitlab服务端redis配置错误的一个解决

在gitlab配置完毕后,我们push一个repo,效果可能如下:

Bash
$ git push origin master:dev
enjoy code, enjoy life.
Total 0 (delta 0), reused 0 (delta 0)
remote: GitLab: An unexpected error occurred (redis-cli returned 1).
To git@xxx:root/my_project.git
 * [new branch]      master -> dev
这儿它提示得已经足够清楚,redis有问题.不过也再也找不到其它提示了.

Life

安装操作系统要不要分区/怎样分区?

  1. 操作系统是win7,8,10? 到步骤3, 操作系统是xp,vista等? 到步骤2 , linux/unix? 步骤 6
  2. <li>C盘分20G,数据放D盘</li>
    
    <li>爱折腾,喜欢重装玩? 到步骤4 , 否则步骤5</li>
    
    <li>C盘放70G,数据放D盘</li>
    
    <li>就一个分区,C盘够了</li>
    
    <li>linux没有c分区之类的,你给/boot一个分区,大小500MB,再swap分区一个,大小和内存相同,其它丢/ 文件系统ext4,lvm,btrfs,zfs自选一个即可,lvm比较中庸,zfs可能略麻烦,btrfs兼容性目前还不是很好,有时候会遇到一些莫名的障碍</li>
    

Code

inliner warnings with Map literal and -optimize

scala在编译&优化的时候,有时候会返回个inline warning.但是,实际上我们写代码已经不能再优化了. 比如如下这个例子: [scala] yu:~ yu$ scala -version Scala code runner version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL yu:~ yu$ scala -optimize -Yinline-warnings Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_05). Type in expressions to have them evaluated. Type :help for more information.

scala> object O { Map( | "a" -> 0, "b" -> 1, "c" -> 2, "d" -> 3, "e" -> 4, | "a" -> 0, "b" -> 1, "c" -> 2, "d" -> 3, "e" -> 4, | "a" -> 0, "b" -> 1, "c" -> 2, "d" -> 3, "e" -> 4, | "f" -> 5, "g" -> 6, "h" -> 7, "i" -> 8) } warning: At the end of the day, could not inline @inline-marked method ->extension warning: At the end of the day, could not inline @inline-marked method -&gt;extension warning: At the end of the day, could not inline @inline-marked method ->extension warning: At the end of the day, could not inline @inline-marked method -&gt;extension defined object O

[/scala]

我们可以看到有个issue ,讲的就是这件事.它是12年底建立的,但一直没啥好的回答...可怜我为了关掉这个warning连带好几个其它warning都不能用了.

不过,今年五月终于有结果了.

Code

a workaround of false negative in missing interpolator warning

一般情况下,我们会倾向于打开各种warning,以便规范我们的代码.不过,scala有时候有些warning也是蛮扯的.比如这么一段 [scala] $ scala -Xlint:missing-interpolator Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_05). Type in expressions to have them evaluated. Type :help for more information.

scala> val key="value"; println("key&quot;) &lt;console&gt;:12: warning: possible missing interpolator: detected interpolated identifier `key` println("$key") ^ $key key: String = value [/scala]

Code

psjrs: 另个基于play的web工程模板

psjrs是一个做了一些修改的scala web工程, 你可以在此基础上很容易得开发出一个你要的工程.

工程基于play, silhouette 等框架. play让人可以很容易搭建一个web service, 而silhouette则提供了用户认证相关的服务. 此外, 我还对配置文件,文件内容进行了一些定制, 使得你可以更容易得组织内容.

Code

docker 几个错误的fix

  1. SELinux安全系统和btrfs文件系统不和 尝试启动docker service失败,使用systemctl查看提示如下:
    Bash
    # systemctl status docker.service -l
    ...
    SELinux is not supported with the BTRFS graph driver!
    ...

Code

CentOS 7下播放音乐

因为避免版权问题,CentOS默认不支持mp3,因此需要安装第三方repo来搞定这个。

首先要安装基本扩展repo,repoforge或者epel至少要个。 然后安装nux-dextop扩展库

Code

怎样让 sbt 强制要求以 UTF-8 编码编译&运行文件

一个简单的方法是, 配置环境变量添加一个 option 到 JAVA_TOOL_OPTIONS

比如如下:

Bash
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

在windows 下, 可以在环境变量里面添加个key为 JAVA_TOOL_OPTIONS, value 为 "-Dfile.encoding=UTF8"

Code

plist 的格式转换

OS X的配置文件一般是plist.存放在Library/Preferences之类的地方.格式为XML.但最近OS X开始把plist变成binary的,文本打开查看变得很困难.

Code

CMake 下使用 protobuf

protobuf是google开发的一个序列化和反序列化的库,通过.proto文件定义文件格式,序列化后的数据是binary的,可以在多语言上使用.一般情况下,若客户端和服务端都是自己做的,用protobuf作为通讯协议,无疑是一个不错的选择.

个人一般喜欢用CMake来管理c++工程.那么,cmake下使用protobuf对个人而言是个很重要的事情.