2003/10/29 水曜日

2003/10/29

カテゴリー: 未分類 — いちごまよ @ 0:00:00

うにょらー

 paper_color = unpack_color(tighten(disperse(0xffdf)));

とかいう記述があって、

inline unsigned short int tighten(
  unsigned long int l) {
  return ((l >> 9) & 0xf800) |
    ((l >> 4) & 0x07e0) |
      (l & 0x001f);
}

inline unsigned long int disperse(
  unsigned short int l) {
  return ((unsigned long int)(l & 0xf800)  < < 9) |
    ((unsigned long int)(l & 0x07c0) << 4) |
      ((unsigned long int)(l & 0x001f));
}

QColor unpack_color(unsigned short int p) {
  int r, g, b;

  r = ((p >> 8) & 0xf8) | 7;
  g = ((p >> 3) & 0xfc) | 3;
  b = ((p < < 3) & 0xf8) | 7;
  QColor c(r, g, b);

  return c;
}

さて問題、paper_colorは何色?=□○_

2003/10/24 金曜日

2003/10/24

カテゴリー: 未分類 — いちごまよ @ 0:00:00

なんとなく(・▽・)

馬鹿っぽさ増量で(・▽・)

2003/10/17 金曜日

2003/10/17

カテゴリー: 未分類 — いちごまよ @ 0:00:00

微妙すくりぷと

必要な物

すくりぷと

require "Win32API"
require "win32ole"

module SIPC
  Connect = Win32API.new("sipc.dll", "Connect", ["P"], "I")
  Disconnect = Win32API.new("sipc.dll", "Disconnect", [], "I")
  Send = Win32API.new("sipc.dll", "Send", ["P", "P", "I"], "I")

  module_function

  def send(command)
    buf = "" * 1024
    Connect .call("rubysample")
    Send .call(command, buf, buf.size)
    Disconnect .call()
    buf.delete!("")
    buf
  end
end

xml = WIN32OLE .new("Microsoft.XMLDOM")
xml.async = false
xml.load("http://slashdot.jp/slashdot.rdf")
text = ""
items = xml.getElementsByTagName("item")
items .length .times do |i|
  item = items.item(i)
  title = item .getElementsByTagName("title") .item(0) .text
  link = item .getElementsByTagName("link") .item(0) .text
  text < < title << "<n>"
  text << link << "<n>"
end

SIPC.send("say #{text}")

微妙な点

HTML convert time: 0.579 sec. Powered by WordPress ME