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でできるのがよいかも。あと通知のタイミングも細かく設定できる。

Saturday, August 14, 2010

clean

ブログでエアコンを掃除した人がいたので
すぐやる課発動で本日朝7時より大掃除をした
2台のエアコン、除湿器、洗濯機回り、洗面棚回り、玄関
エアコンの吹き出し口は黒カビと埃で真っ黒けの状態だった
これじゃ具合も悪くなる
完全にカビを取ることはできなかったけど7割くらいはいったか
これで鼻詰まりも治るかな
二人とも全力投球で現在ぐったり
でもクリーンになって気持ちはすっきり
あとは映画でも見て今日はまったり
だな

Tuesday, August 10, 2010

book search

本の検索・書庫登録サイトの構築
アフィリエートで稼ぐには一番効率がいいのじゃないかと気付く

Sunday, August 08, 2010

denki

電気代 8月分 10,536円(458kWh)

Tuesday, July 27, 2010

Posterous

Posterousというブログサービスを試してみる
投稿はメールですることが基本になっていて
最初の投稿はアカウントを取る前にできてしまう
ソーシャル的な要素が強くて
ブログとTwitterを合わせたような感じ
他者のブログをfollower登録みたいにそこで購読できる