睡五分鐘勝過睡六小時的方法
健康 知識 一個睡五分鐘等於六個鐘頭的方法!
這睡覺的訣竅是南懷瑾那老傢伙說的,有沒有實效嘛,真的要諸君一起驗證。
根據醫學和我的體驗、觀察,一個人真正睡著覺最多只有兩個鐘頭,其餘都是浪費時間,躺在枕頭上做夢
利用 Java 為圖像添加邊緣(Use Java to trim an image )
import java.awt.image.BufferedImage;import java.awt.Graphics2D;import java.awt.Color;
public static BufferedImage trim(BufferedImage source, int topMargin, int bottomMargin, int leftMargin, int rightMargin, Color color){ int width = source.getWidth() + leftMargin + rightMargin; int height = source.getHeight() + topMargin + bottomMargin; BufferedImage out = new BufferedImage(width, height, source.getType()); Graphics2D g2d = out
A DVCS advantage for open source development
Recently, an interesting advantage of DVCSes for open source developmenthas occurred to me: their very nature makes it so that the initialsource of an open source release cannot really reverse itself.
Suppose that you are a company that mightwant to retract and de-release something that has been releasedas open source . With traditionalnon-distributed version control, you could simply shut down the publicsource server for the project; while people who already had copies ofthe source base could in theory put together another public sourceserver
咬文嚼字的基因?
我喜歡咬文嚼字,所以寫詩作文、哲學分析、玩文字遊戲、 抬槓,和捉字蝨等都能令我滿足過癮。不過,我倒不知是我先天喜歡咬文嚼字,而令我愛上這些活動,還是我在這些活動中養成了咬文嚼字的習慣。
看到兒子的情況,我
看到兒子的情況,我
36 Views from the Pic Saint-Loup ("小山36景") ------ 看不出36景!
Film: 36 Views from the Pic Saint-Loup (2009)
Directed by Jacques Rivette
Written by Pascal Bonitzer/ Christine Laurent/ Jacques Rivette
Starring Jane Birkin/ Sergio Castellitto
Running Time: 84 minutes
Country: France/Italy
Language: French
1. 看的原因當然是因為Jane Birkin(珍寶金),至於導演是法國新浪潮導演之一,不過其實我看之前是不懂的,亦沒
利用 Java 過濾圖像的色彩頻道 (Use Java to filter the color channel of an image)
import java.awt.image.BufferedImage;import java.awt.Color;
public static BufferedImage getColorChannel(BufferedImage source, Color color){ BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), source.getType()); for (int i = 0; i < out.getHeight(); i++) { for (int j = 0; j < out.getWidth(); j++) { out.setRGB(i, j
利用 Java 將圖像轉換成灰度圖像 (Use Java to edit an image to grayscale)
import java.awt.image.BufferedImage;import java.awt.Graphics2D;
public static BufferedImage grayscale(BufferedImage source){ BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TYPE_BYTE_GRAY); Graphics2D g2d = out.createGraphics(); g2d.drawImage(source, 0, 0, null); g2d.dispose(); return out;}修改前
before
修改
在 Java 正確複製 BufferedImage 的圖像資料 (Correct way to copy BufferedImage data from Java)
import java.awt.image.BufferedImage
public static BufferedImage copy(BufferedImage source){ return (BufferedImage)source.clone();}BufferedImage img1 = source;BufferedImage img2 = copy(source);以上兩種是有分別的
img1 會得到與 source 相同的 hash code, 所以兩者是完全相同的, 當 img1 被修改 source 同樣會被修改
img2 則是將 source 的每一個 pixel
利用 Java 剪裁圖像的指定範圍 (Use Java to cut a rectangle of area from an image)
import java.awt.image.BufferedImage;import java.awt.Graphics2D;import java.awt.Color;
public static BufferedImage cut(BufferedImage source, int x, int y, int width, int height, int cx, int cy, Color color){ BufferedImage out = new BufferedImage(width, height, source.getType()); Graphics2D g2d = out.createGraphics(); g2d.setColor(color); g2d.fillRect(