朋友裝了新系統,變色龍帶綠色的皮膚與圓睜睜的大眼睛,當她拿給我們看時,一位對Linux十分感與趣的同學說:
「啊,桌布的Geeko好可愛!」
「我沒用過openSUSE耶,好用嗎?」我說。
「根本糞distro。不用Arch的人都智能不足啦。」一位見到人就要傳教、外號叫「引戰客」的同學緊接著說。
我們不禁啞然失笑,同樣的一個distro,每個人卻有不同的感覺。那位朋友連忙把筆電蓋上,她覺得openSUSE就是openSUSE,不是變色龍,也不是智力測驗,更不是宗教。
朋友裝了新系統,變色龍帶綠色的皮膚與圓睜睜的大眼睛,當她拿給我們看時,一位對Linux十分感與趣的同學說:
「啊,桌布的Geeko好可愛!」
「我沒用過openSUSE耶,好用嗎?」我說。
「根本糞distro。不用Arch的人都智能不足啦。」一位見到人就要傳教、外號叫「引戰客」的同學緊接著說。
我們不禁啞然失笑,同樣的一個distro,每個人卻有不同的感覺。那位朋友連忙把筆電蓋上,她覺得openSUSE就是openSUSE,不是變色龍,也不是智力測驗,更不是宗教。
(defun run-length (results) | |
(if (null results) | |
results | |
(let ((tmp (run 1 (car results) (cdr results)))) | |
(cons (car tmp) (run-length (cdr tmp)))))) | |
(defun run (times elem remains) | |
(cond ((equal elem (car remains)) (run (1+ times) elem (cdr remains))) | |
((= times 1) (cons elem remains)) | |
((> times 1) (cons (list times elem) remains)))) |
;; (:= a 1) a = 1 | |
;; (:= a (list 1 2 3)) a = (1 2 3) | |
;; (:= (a b c) (1 2 3)) a = 1, b = 2, c = 3 | |
(defmacro := (places values) | |
`(cond ((and (listp (quote ,places)) | |
(listp ,values)) | |
(if (eq (length (quote ,places)) (length ,values)) | |
(map 'list (lambda (sym val) (set sym val)) (quote ,places) ,values) | |
(error "The length of two args are not equal"))) |
(setq hexo-help-buffer "*hexo-help*") | |
(defun hexo-command-open-fixed-help-window () | |
(interactive) | |
(select-window (split-window-below -6)) | |
(if (not (get-buffer hexo-help-buffer)) | |
(temp-buffer-window-setup hexo-help-buffer)) | |
(switch-to-buffer hexo-help-buffer) | |
(let ((inhibit-read-only t)) | |
(insert (hexo-get-help-string))) |
#! /usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import os, subprocess, re | |
import fileinput | |
def replaceTabInFile(filePath): | |
print("Processing file {} ...".format(filePath)) | |
with fileinput.FileInput(filePath, inplace=True) as f: | |
for line in f: |
Canvas { | |
id: canvasTest | |
property int ratio: Screen.devicePixelRatio | |
width: 100 //* ratio | |
height: 100 //* ratio | |
//scale: 1/ratio | |
Path { | |
id: myPath1 | |
startX: 0; startY: 50 |
Item { | |
id: videoArea | |
anchors.top: parent.top | |
width: parent.width | |
height: parent.height - panelRectangle.height | |
VideoOutput2 { | |
id: videoOutput | |
anchors.fill: parent | |
source: player | |
} |
這個範例中使用 Loader { sourceComponent: block }
來載入名為 block
的 component,會導致 ColumnLayout
無法在 block
的 visible
狀態改變時自動調整大小。
然而,如果把 block
獨立出成單一檔案 Block.qml
,然後直接在 ColumnLayout
中使用 Block {}
來載入 component,就沒有上述問題,Layout能夠自動根據 Block
的 visible
來自動調整大小。
在QML中,我常常寫類似這樣的東西:
Item {
id: settings
property alias snapshot: snapshot
Item {
id: snapshot
property string saveDirectory: "~/hello/world/"
}
}