Friday, September 10, 2010

千趣会ブラインド

  • 5つ買ったブラインドのうち4つのジョイントがイカれたので、部品を購入する目的で千趣会にTEL。一応ちょっと不良品ぽいと一言
  • 後日担当(小谷さん)より電話が有り、部品交換はできず、更に現在その商品は取り扱っていないとの連絡。しかし4つも壊れたということで、検討のため是非とも写真をくれと
  • 写真を撮影し簡単な説明と共に、同日メール
  • 本日電話あり、破損状況が酷いのにおどろいていると。ついては全品を現行販売品と交換させてもらいたいと。なんと意外な展開
  • 商品着後、元の品を返品要。カスタマーセンターに引取り連絡要
買ってから2年半も経過しているので、部品購入、あるいは最悪部品ナシで諦めかと予想していたけど、まさかこのような展開になるとは。
まあでも4つも同じ箇所が破損していることを考えれば、これは不良品といっていいな。
また取り付け作業が大変だけど、不便がなくなるのでそのほうがいい。

Processing methods

  1. 画面サイズ: size(x, y)
  2. 点と線: point(x, y), line(x1, y1, x2, y2)
  3. 多角形: rect(x1, y1, w, h), triangle(x1, y1, x2, y2, x3, y3), quad(x1, y1, x2, y2, x3, y3, x4, y4)
  4. 多角形モード: rectMode([CORNER, CENTER, CORNERS])
  5. 円と弧: ellipse(xc, yc, dw, dh), arc(xc, yc, dw, dh, radians(rs), radians(re))
  6. 曲線: curve(x1, y1, x2, y2, x3, y3, x4, y4), bezier(x1, y1, cx1, cy1, x2, y2, cx2, cy2)
  7. 複雑な形: beginShape(); vertex(x1, y1); vertex(x2, y2).. endShape(CLOSE);
  8. 複雑な曲形: beginShape(): curveVertex(x1, y1).. endShape();
  9. 色モード: colorMode([HSB, RGB], range(h_range, s_range, b_range))
  10. 背景色: background([grayscale, 16bit, (H, S, B/R, G, B)])
  11. 線の属性: stroke([grayscale, 16bit, (H, S, B/R, G, B)], opac), noStroke(), strokeWeight(w)
  12. 面の属性: fill([grayscale, 16bit, (H, S, B/R, G, B)], opac), noFill()
  13. エッジの属性: smooth(), noSmooth()
  14. データ型: boolean, int, float, color, byte, char
  15. 変数宣言: int i_data; float f1_data, f2_data; int i_data = 10
  16. 型変換: boolean(string_data), int(data)
  17. 色データ型: color c = color(h, s, b); fill(c)
  18. システム変数: width, height
  19. 座標変換: translate(moveX, moveY), rotate(radians(120)), scale(0.5), pushMatrix(), popMatrix()
  20. 画像の読み込み: PImage img = loadImage("sample.jpg")
  21. 画像の表示: image(img, x, y, w, h)
  22. 画像モード: imageMode([CORNER, CORNERS, CENTER])
  23. 画像の色指定: tint([grayscale, 16bit, (H, S, B/R, G, B)]), noTint()
  24. 画像の操作: img.width, img.height, img.copy(), img.mask(other_pimage)
  25. 文字の表示: textSize(24); textAlign(CENTER), text("hello", x, y (w, h))
  26. フォントの指定: PFont font = loadFont("sample.vlw"); textFont(font)
  27. コンソール出力: println(x)
  28. ゆらぎの表現: rect(x+random(-range, range), y+random(-range, range), 10, 10)
  29. マウスの移動距離: dist(mouseX, mouseY, pmouseX, pmouseY)
  30. PDFに出力: import processing.pdf.*; size(x, y, "out.pdf"); exit()
  31. 初期化: void setup(){ size(x, y); background(); colorMode(); frameRate(r); }
  32. メインループ: void draw(){ stroke(color); int x = int(random(w)); int y = int(random(h)); rect(...) }
  33. 関数定義: void fadeToWhite(c, f){ noStroke(); fill(c, f); rectMode(CORNER); rect(0,0,width,height); }
  34. スピードの減衰: float FRICTION = 0.94; SpeedX *= FRICTION; X += SpeedX
  35. 円の動き: Angle += 10; X = CircleX + (R * cos(radians(Angle))); Y = CircleY + sin(radians(Angle))
  36. 落下の動き: float GRAVITY = 3; SpeedY += GRAVITY; Y += Speedy
  37. バネの動き: float distY = Y - SpringLen; Accy = -K * distY; SpeedY = FRICTION * (SpeedY + Accy)
  38. 引力の動き: float SCALE = 0.0005; float distX = X - targetX; Accx = SCALE * sq(distX); if(X>targeX) Accx = -Accx
  39. マウスの動き: float speed = dist(mouseX, mouseY, pmouseX, pmouseY)
  40. マウスクリック: void mousePressed(){ if(mouseButton == LEFT) ... }
  41. マウスの移動: void mouseMoved(){...}, void mouseDragged(){...}
  42. キーの入力: void keyPressed(){ switch(key){ case 'a':...break;}}, void keyReleased(){...}
  43. 配列宣言: int[] X = new int[Length], int[][] map = {{1,2,3},{4,5,6},{7,8,9}}
  44. マウスドラッグ: void mousePressed(){ if(OnMouse) onDrag = true }; void mouseReleased(){ OnDrag = false}
  45. 力をためる: if(mousePressed){ Power += 1}
  46. ピクセル操作: PImage img = loadImage("s.jpg"); img.loadPixels(); pos = (y*img.width)+x; pixels[pos] = img.pixels[pos]; updatePixels();
  47. 3D座標: size(x, y, P3D); line(x1, y1, z1, x2, y2, z2)
  48. クラス定義: public class Ball(){ Ball(){ ..initialize..} public void move(){...} }
  49. テキストファイルの読み込み: String[] Str; Str = loadString("data.txt"); text(Str, x, y)
  50. 時間の表示: text(year() + "/" + month() + "/" + day())
  51. 範囲変換: float mapped_val = map(mouseX, 0, width, 0, 100)
  52. 中間色変換:color c = lerpColor(color1, color2, map(x, 0, width, 0, 1))
  53. XMLを読む: XMLElement Xml = new XMLElement(this, xml_data); Xml.getChild(0).getContent()
  54. 音楽再生: import ddf.minim.*; Minim m = new Minim(this); AudioPlayer audio = m.loadFile("s.mp3", 2048);
  55. 音楽再生2: audio.play(), pause(), isPlaying, length, position, close(); m.stop()
  56. 波形発振: import ddf.minim.*;import ddf.minim.signals.*; Minim minim; AudioOutput out; SineWave sine; SquareWave square;
  57. 波形発振2: minim = new Minim(this); out = minim.getLineOut(Minim.STEREO); sine = new SineWave(440, 0.5, out.sampleRate()); out.addSignal(sine)

Processing Heros

Processing Heros
Ben Fry http://benfry.com/
Casey Reas http://reas.com/
Aaron Koblin http://www.aaronkoblin.com/
Golan Levin http://www.flong.com http://artport.whitney.org/commissions/thedumpster/
Jared Tarbell http://levitated.net/ http://www.complexfication.net/
Karsten Schmidt http://postspectacular.com/
LIA http://www.liaworks.com/
Robert Hodgin http://roberthodgin.com/
Usman Haque http://www.haque.co.uk/
d.v.d http://www.dvd-3.com/

Wednesday, September 08, 2010

2010年9月分電気代

14,559円!
去年の倍!

Tuesday, September 07, 2010

vim helptags [dir]

help fileを登録する
:helptags [dir]

Monday, September 06, 2010

processing to pdf

processing to pdf
libraryをインポートして、最後にexit()する

import processing.pdf.*;

size(200, 200, PDF, "sample.pdf");
colorMode(HSB, 100);
background(100);
noStroke();

for (int i = 0; i<500; i++){
 
  float color1 = random(0, 50);
  float color2 = random(50, 100);
  fill(color1, color2, color2, 60);
  float x = random(200);
  float y = random(200);
  rect(x, y, 10, 10);
}
exit();

processing environment

Processingのエディタがチョ絶使い辛いので
VimかTMで環境構築を試みるもどうもうまくいかない
Python実行でこける
で最新のPythonをインストールしたりするもダメ

TMではprocessing bundleが/Library/..に入ってしまいTM_BUNDLE_SUPPORT pathと不一致だったので移行するも効果なし

まあいずれのエディタでもsyntax highlightがつかえるようになったのでよしとするか

Saturday, September 04, 2010

vim commands

fa, Fa, ta, Ta: find next a in the line

d3w, d3aw: delete 3 words

df>, dF>: delete words to > mark

. : repeat previous command

mx->d`x: delete words from 'x' mark

mx->y`x: yank words from 'x' mark

!10Gsort: sort 10 lines

!!ls: insert ls output to current line

>>, <<: shift

=%: indent inner of {}

%: move between parentheses

>%, >i{: indent inner block

v->i{>: indent inner block at visual mode

abbreviate

map i{ea} word wrap with {}

fx ; ,: repeat forward or backword find x

s, S: xi, ddi

~: upper lower convert

*, #: word search forward or backword

regex: /\/ : find only 'for' word not include 'forword', 'information'

: \t \= : +, ?

: \a \d : a word a number

iPhone Development

  1. iPhone用の画面設計
  2. jQTouchの利用
  3. クライアントサイド・ストレージの使用
  4. オフラインキャッシュの使用
  5. ネイティブ化

1.iPhone用の画面設計
  • meta veiwport width=device-width, calabe=no
  • link stylesheet media=screen
  • meta apple-mobile-web-app-capable
  • touchstart: document.addEventListener("touchstart", click, false)
  • touchmove: document.addEventListener("touchmove", move, false) def move...
  • イベントターゲットの調整
2.jQTouchの利用
3.クライアントサイド・ストレージの使用
  • localStrage
  • SessionStrage
  • DataBase
4.オフラインキャッシュの使用
5.ネイティブ化
  • PhoneGap
  • Rhodes

vim commands

:registers show register text
"ayy : copy to 'a' register
i<C-r>a : yank from 'a' register
<C-w>r, x : rotate or switch windows
:wall, :qall, :wqall  : write all opened files
v-mode:
  $, aw, o  : select to end, word, top-bottom toggle
  gv : repeat last vmode ope
  ~, v, V : convert word
:set scrollbind, :syncbind

Friday, September 03, 2010

Macbook Pro + iPod Touch

Macbook Pro + iPod Touch

  • アマゾンは5%OFF
  • アマゾンで他業者のが更に500円安い
  • 最安値は価格.comでアマゾンより1万円更に安い。でもちょっと不安
  • ヨドバシ他は値引きナシポイント8%(現金)とか
まあ予算30万円

(追記)英語キーボードヴァージョンはAppleでしか買えないことが、ヨドバシにて判明。

Thursday, September 02, 2010

iPhone開発まとめ

現在わかっていること
  • 開発の方法として2種類ある
  • 1つは、スタンダードな方法で、xcode上でObjective-Cを使ってコーディングし、コンパイル
  • もう1つは、HTML+CSS+Javascriptを使ってコーディングし、PhoneGapでxcode上のコードに変換する
  • HTML..を使う場合、jQTouchは必須。アニメーションはiProcessing.jsがある。
  • HTML..を使う場合、AppStoreを通さないWebアプリであればPhoneGapは不要
  • PhoneGapとiphone対応のxcodeはLeopard上でなければ動作しない
  • AppStoreを通す場合は$99/年が必要
  • 結局、AppStoreを通すiPhone開発にはLeopardは必須

iprocessingが動かない?

ipodでprocessingを動かすためにprocessing.jsを改良したiprocessing.jsというのがあって
これをためしてるんだけれども、うまくいかない。
  • ipod独自のファンクションであるtouchmoveとかが普通のmousemoveになっていて効かない
  • animationはちょっと重くて使えない
  • 現在はhtml+javascriptをそのまま動かしている
  • xcodeでobjective-cにコンパイルしてインストールすることができるけれどもTigerじゃできない
だからObjective-Cにコンパイルできればうまくいくかも知れないけど
現時点ではわからない

Michael Schieben // rockitbaby.de http://www.rockitbaby.de/experiments/processingjs-on-iphone#

Wednesday, September 01, 2010

processing on iphone with sinatra

app.rb
require "sinatra"
require "haml"
require "sass"


get '/' do
  haml :index
end

get '/style.css' do
  content_type 'text/css', :charset => 'utf-8'
  sass :style
end

index.haml
!!!
%html
  %head
    %meta{:'http-equiv' => 'Content-type', :content => 'text/html', :charset => 'utf-8'}
    %meta{:name => "viewport", :content => "user-scalable=no, width=device-width, minimum-scale=1.0, maximum-scale=1.0"} //iphoneで画面の幅を合わせる
    %meta{:name => "apple-mobile-web-app-capable", :content => "yes"}   //iphoneでフルスクリーンモードに
    %meta{:name => "apple-mobile-web-app-status-bar-style", :content => "black"} //iphoneでステータスバーを黒に
    %title Processing
    %link{:rel => 'stylesheet', :href => '/style.css', :type => 'text/css', :media => "only screen and (max-width: 480px)"} //iphone用のCSS
    %link{:rel => 'stylesheet', :href => '/style.css', :type => 'text/css', :media => "only screen and (min-width: 481px)"} //desktop用のCSS
    %script{:type => 'text/javascript', :src => '/javascripts/jquery.js'}
    %script{:type => 'text/javascript', :src => '/javascripts/processing.js'}
    %script{:type => 'text/javascript', :src => '/javascripts/myjs.js'}
  %body
    %canvas.processing //processingの描画エリアの確保


myjs.js
$(document).ready(function(){
  function move (e) {
    e.preventDefault();
    return false;
  }

  function click (e) {
    alert(e);
    return false;
  }
    //processingで外部ファイルの読み込み
    var processing_init = function(obj, url) {
        obj.each( function(){
            var canvas = $(this)[0];
            var p = Processing( canvas );
            var code = $(this).text() || p.ajax( url );
            Processing( canvas, code );
        });
    };
    processing_init( $('.processing'), 'javascripts/head-animation.pjs' );

  //document.addEventListener("touchstart", click, false);
  //document.addEventListener("touchmove", move, false);
  $(document).bind('touchmove', move);//iphoneで画面スクロールを禁止
  $(document).bind('touchstart', click); //iphoneのtouchstartイベント


});

default.pjs
/*
  PROCESSINGJS.COM - BASIC EXAMPLE 
  Delayed Mouse Tracking
  MIT License - Hyper-Metrix.com/F1LT3R
  Native Processing compatible
*/ 

// Global variables
float radius = 50.0;
int X, Y;
int nX, nY;
int delay = 16;

// Setup the Processing Canvas
void setup(){
  size( 180, 100 );
  strokeWeight( 10 );
  frameRate( 15 );
  X = width / 2;
  Y = height / 2;
  nX = X;
  nY = Y; 
}

// Main draw loop
void draw(){
 
  radius = radius + sin( frameCount / 4 );
 
  // Track circle to new destination
  X+=(nX-X)/delay;
  Y+=(nY-Y)/delay;
 
  // Fill canvas grey
  background( 100 );
 
  // Set fill-color to blue
  fill( 0, 121, 184 );
 
  // Set stroke-color white
  stroke(255);
 
  // Draw circle
  ellipse( X, Y, radius, radius );                 
}


// Set circle's next destination
void mouseMoved(){
  nX = mouseX-200;
  nY = mouseY-200; 
}


Thursday, August 26, 2010

some vim command

fa, Fa, ta, Ta: find next a in the line
d3w, d3aw: delete 3 words
df>, dF>: delete words to > mark
. : repeat previous command
mx->d`x: delete words from 'x' mark
mx->y`x: yank words from 'x' mark
!10Gsort: sort 10 lines
!!ls: insert ls output to current line
>>, <<: shift
=%: indent inner of {}
%: move between parentheses
>%, >i{: indent inner block
v->i{>: indent inner block at visual mode
abbreviate
map i{ea} word wrap with {}
fx ; ,: repeat forward or backword find x
s, S: xi, ddi
~: upper lower convert
*, #: word search forward or backword
regex: /\/ : find only 'for' word not include 'forword', 'information'
: \t \= : +, ?
: \a \d : a word a number

Wednesday, August 18, 2010

barbar Sati

barbar Sati
さっぱり!

Tuesday, August 17, 2010

pony_gmail

require 'pony'
require "openssl"
require "net/smtp"

Net::SMTP.class_eval do
  private
  def do_start(helodomain, user, secret, authtype)
    raise IOError, 'SMTP session already started' if @started
    check_auth_args user, secret, authtype if user or secret

    sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
    @socket = Net::InternetMessageIO.new(sock)
    @socket.read_timeout = 60 #@read_timeout

    check_response(critical { recv_response() })
    do_helo(helodomain)

    if starttls
      raise 'openssl library not installed' unless defined?(OpenSSL)
      ssl = OpenSSL::SSL::SSLSocket.new(sock)
      ssl.sync_close = true
      ssl.connect
      @socket = Net::InternetMessageIO.new(ssl)
      @socket.read_timeout = 60 #@read_timeout
      do_helo(helodomain)
    end

    authenticate user, secret, authtype if user
    @started = true
  ensure
    unless @started
      # authentication failed, cancel connection.
      @socket.close if not @started and @socket and not @socket.closed?
      @socket = nil
    end
  end

  def do_helo(helodomain)
    begin
      if @esmtp
        ehlo helodomain
      else
        helo helodomain
      end
    rescue Net::ProtocolError
      if @esmtp
        @esmtp = false
        @error_occured = false
        retry
      end
      raise
    end
  end

  def starttls
    getok('STARTTLS') rescue return false
  return true
  end

  def quit
    begin
      getok('QUIT')
    rescue EOFError
    end
  end
end

TellMeWhen(仮題)というメモ&タスク管理的なWebツールを起案

TellMeWhen(仮題)というメモ&タスク管理的なWebツールを起案・試作したんだけど
リマインド通知をGmailでしようと実装を検討していたところ
「それじゃ不便・うざいよ」とさち
まあたしかにね

で行き詰まったので
試しにRememberTheMilkという有名なタスク管理サービスがあるのでちょっと使ってみたところ
通知のタイミングを細かくしていできるのと
Adiumで通知できたりして
「これでたりなくね?」的な感じになってます

別のこと考えるか

ruby: pony

簡単にメールを送信するためのponyというtmailのラッパーライブラリを発見
ただgmailのSMTPを使う場合はNet::smtpに修正がいるようで
それをした人のpony_gmail.rbを使う必要がある。

remember the milk

remember the milkを使い始めてみる。通知をGmailじゃなくてAdiumでできるのがよいかも。あと通知のタイミングも細かく設定できる。