We made it possible. Next, we'll make it beautiful.
Suffering-oriented programming
- 柔軟性向上
- 予想以上に複雑な使い方をしているケースが多かったので、設定ファイルも複雑化して対応する
function F(){} | |
Object.defineProperty(F.prototype, 'foo', { | |
get: function(){ return F._foo; }, | |
set: function(value){ F._foo = value; } | |
}); | |
var obj = new F(); | |
obj.foo; // undefined | |
obj.foo = 1; |
function! Jump2PrevDiffText() | |
let line=line(".") | |
let idx=col(".")-1 | |
if synIDattr(diff_hlID(line, idx), "name")=="DiffChange" || synIDattr(diff_hlID(line, idx), "name")=="DiffText" | |
while idx>0 | |
if synIDattr(diff_hlID(line, idx), "name")=="DiffText" && synIDattr(diff_hlID(line, idx-1), "name")!="DiffText" | |
call setpos(".", [0,line,idx]) | |
break | |
elseif idx==1 | |
let line=line(".") |
// ============================================================ | |
// Objects vs Primitives | |
// To make a long story short, use primitives wherever you can. | |
// ============================================================ | |
// Primitive types: Null, Undefined, Number, Boolean, String. | |
var num1 = 9000, | |
num2 = new Number( 9000 ), | |
str1 = "hello world", |
--- pytc.c.orig 2011-12-01 02:31:54.000000000 +0400 | |
+++ pytc.c 2011-12-01 02:32:21.000000000 +0400 | |
@@ -1555,14 +1555,15 @@ | |
int max; | |
TCLIST *list; | |
char *prefix; | |
+ int prefix_len; | |
static char *kwlist[] = {"prefix", "max", NULL}; | |
- if (!PyArg_ParseTupleAndKeywords(args, keywds, "si:rangefwm", kwlist, |
We made it possible. Next, we'll make it beautiful.
Suffering-oriented programming
Fluentd v11 設計案 の「1. 内部ルーティングラベルの導入」について、続き。
by fcicq, CC-BY
SmartMachine 是 Joyent 家的虚拟化方案.
SmartOS 主要的卖点是 ZFS + DTrace + Zones (SmartMachine) + KVM (运行 Linux, Windows 等).
实际上 SmartOS 是 Joyent 以 Solaris 为基础 (因为 OpenSolaris 项目被中止而改名 illumos) 打包的操作系统.
SmartOS 作为 HOST 时, 虽然支持 KVM 虚拟化, 但不支持突发的 vCPU.
而 SmartMachine 是基于 Zones 的 (存储则是 ZFS), 比较类似 Linux 平台下 OpenVZ 或者 LXC 的方案.
资源用量由调度器决定, 只需要修改配额 (ZFS 也支持在线扩展) 就可以伸缩, 所以伸缩不需要重启.
; supervisor config file | |
[unix_http_server] | |
file=/var/run/supervisor.sock ; (the path to the socket file) | |
chmod=0700 ; sockef file mode (default 0700) | |
[supervisord] | |
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | |
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) |
#!/bin/env python | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.options | |
import tornado.web | |
import tornado.httpclient | |
import tornado.gen | |
from tornado.concurrent import run_on_executor | |
from concurrent.futures import ThreadPoolExecutor |
# maybe.py - a Pythonic implementation of the Maybe monad | |
# Copyright (C) 2014. Milan Oberkirch <milan.py@oberkirch.org> | |
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |