「Open」を含む日記 RSS

はてなキーワード: Openとは

2007-04-13

ASPファイル受信

'/** Requestオブジェクトから受信したデータを取り出します。
' * @return byte配列を格納した連想配列を返します。
' */
Function getRequestItem()

  If Request.TotalBytes <= 0 Then
    getRequestItem = Null
    Exit Function
  End If

  Dim data
  Dim separator
  Dim dataArray
  Dim buffer
  Dim filePath
  Dim fileName
  Dim ix
  Dim stringIndex
  Dim myCrLf
  Dim items
  Dim itemName

  myCrLf = convertAsc(vbCrLf)
  Set items = Server.CreateObject("Scripting.Dictionary")

  data = Request.BinaryRead(Request.TotalBytes)
  data = LeftB(data, UBound(data) - 3) & myCrLf

  separator = MidB(data, 1, InStrB(1, data, myCrLf) + 1)

  dataArray = SplitB(data, separator)

  For ix = 2 To UBound(dataArray) Step 1
   '1行読み込み
    buffer = MidB(dataArray(ix), 1, InStrB(1, dataArray(ix), myCrLf) - 1)

   'アイテム名の取得
    stringIndex = InStrB(1, buffer, convertAsc("name="))
    If stringIndex > 0 Then
      itemName = convertUnicode(MidB(buffer, stringIndex + 6, InStrB(stringIndex, buffer, ChrB(34)) - stringIndex))
     Else
      itemName = ""
    End If

   'ファイル名の取得
    stringIndex = InStrB(1, buffer, convertAsc("filename="))
    If stringIndex > 0 Then
      filePath = MidB(buffer, stringIndex + 10, InStrB(stringIndex, buffer, ChrB(34)) - stringIndex)
      fileName = RightB(filePath, LenB(filePath) - LastInStrB(0, filePath, convertAsc("\")))
     Else
      fileName = ""
    End If

   'データ部の取得、改行コードの切り捨て
    buffer = RightB(dataArray(ix), LenB(dataArray(ix)) - InStrB(1, dataArray(ix), myCrLf & myCrLf) - 3)
    buffer = LeftB(buffer, LenB(buffer) - 2)

    items.Item(itemName) = parseBytes(buffer)
  Next

  Set getRequestItem = items
  Set items = Nothing

End Function

'/** 文字列の最後尾から指定文字を検索します。
' * @param Start 検索する開始文字位置を指定します。
' * @param String1 検索対象の文字列を指定します。
' * @param String2 検索する文字列を指定します。
' */
Function LastInStrB(ByRef Start, ByRef String1, ByRef String2)

  Dim ix
  Dim lastIndex
  Dim searchLength

  searchLength = LenB(String2)
  lastIndex = LenB(String1) - searchLength + 1
  If Start > 0 And Start < lastIndex Then
    lastIndex = Start
  End If
  For ix = lastIndex To 1 Step -1
    If MidB(String1, ix, searchLength) = String2 Then
      LastInStrB = ix
      Exit Function
    End If
  Next

  LastInStrB = 0

End Function

'/** アスキー文字列に変換します。
' * @param String 対象の文字列を指定します。
' */
Function convertAsc(Byref String)

  Dim ix
  Dim ascii

  ascii = ""
  For ix = 1 To Len(String) Step 1
    ascii = ascii & ChrB(AscB(Mid(String, ix, 1)))
  Next

  convertAsc = ascii

End Function

'/** Unicode文字列に変換します。
' * @param AscString 対象のアスキー文字列を指定します。
' */
Function convertUnicode(Byref AscString)

  Dim ix
  Dim unicode

  unicode = ""
  For ix = 1 To LenB(AscString) Step 1
    unicode = unicode & Chr(AscB(MidB(AscString, ix, 1)))
  Next

  convertUnicode = unicode

End Function

'/** バイナリ対応版Split関数です。
' * @param String 対象の文字列を指定します。
' * @param Delimiter 区切り文字を指定します。
' */
Function SplitB(Byref String, Byref Delimiter)

  Dim ix
  Dim lastIndex
  Dim searchLength
  Dim start
  Dim datas()
  Dim dataIndex

  dataIndex = 1
  start = 1
  delimiterLength = LenB(Delimiter)
  lastIndex = LenB(String) - delimiterLength + 1

 '最初から1文字ずつ繰り返します。
  For ix = 1 To lastIndex Step 1
   'データを比較します。
    If MidB(String, ix, delimiterLength) = Delimiter Then
     'データを取り出せたら配列に格納します。
      ReDim Preserve datas(dataIndex)
      datas(dataIndex) = MidB(String, start, ix - start)
      dataIndex = dataIndex + 1
      start = ix + delimiterLength
    End If
  Next

  SplitB = datas

End Function

'/** Byte配列を返す関数です。
' * @param data 対象のデータを指定します。
' */
Function parseBytes(Byref data)

  Const adLongVarBinary = 205
  Dim recordset

  If LenB(data) <= 0 Then
    parseBytes = CByte(0)
    Exit Function
  End If

  Set recordset = Server.CreateObject("ADODB.Recordset")
  recordset.Fields.Append "UpLoadBinary", adLongVarBinary, LenB(data)
  recordset.Open
  recordset.AddNew
  recordset.Fields("UpLoadBinary").AppendChunk data
  recordset.Update

  parseBytes = recordset.Fields("UpLoadBinary").Value
  recordset.Close
  Set recordset = Nothing

End Function

2007-04-12

Re: Re: Re: Re:早速バグありましたかorz

おおすばらしいい。自分でなおさなくてもなおしてくれる人たちがいた。OSS!OSS!

最初に指摘された引用記法の問題も取り入れて、

javascript:Yid='ゆーざID';d=document;w=window;function bq(s){return s?'>>\n'+s+'\n<<':s;}function enc(s){return encodeURIComponent?encodeURIComponent(s):encodeURI(s);}if(d.selection){q=d.selection.createRange().text;}else if(d.getSelection){q=d.getSelection();}else if(w.getSelection){q=w.getSelection();}void(w.open('http://anond.hatelabo.jp/'+Yid+'/edit?title=Re: [anond:'+enc(location.href.slice(25,39))+':title];body='+enc(bq(q)),'_self',''));

Re: Re: Re:早速バグありましたかorz

確信なかったので、とりあえず書かずに実験したわけだけど、

Re: Re:早速バグありましたかorz


んじゃーこれでいいんじゃないかな?

javascript:Yid='ゆーざID';d=document;w=window;function bq(s){return '>>\n'+s+'\n<<';}function enc(s){return encodeURIComponent?encodeURIComponent(s):encodeURI(s);}if(d.selection){q=d.selection.createRange().text;}else if(d.getSelection){q=d.getSelection();}else if(w.getSelection){q=w.getSelection();}void(w.open('http://anond.hatelabo.jp/'+Yid+'/edit?title=Re: [anond:'+enc(location.href.slice(25,39))+':title];body='+enc(bq(q)),'_self',''));

Re:そんなあなたに

javascript:Yid='あなたのID';d=document;w=window;function bq(s){return '>>\n'+s+'\n<<';}function enc(s){return encodeURIComponent?encodeURIComponent(s):encodeURI(s);}if(d.selection){q=d.selection.createRange().text;}else if(d.getSelection){q=d.getSelection();}else if(w.getSelection){q=w.getSelection();}void(w.open('http://anond.hatelabo.jp/'+Yid+'/edit?title=anond:'+enc(location.href.slice(25,39))+':title=Re:'+d.title+'&amp;body='+enc(bq(q)),'_self',''));

上記のjavascriptの あなたのID 欄をはてラボでのIDに変えれば使えます。

返答したい増田エントリをひとつだけ表示してブックマークレットを実行すると、新しい記事のタイトルが Re:元のタイトル になり、元のエントリトラックバックが飛んで、選択していた領域を引用するように動きます。

おお、これは便利。これだと選択領域がなくても引用記法が入ってしまうので、

bq(s){return '>>\n'+s+'\n<<';}

部分を、

bq(s){return s?'>>\n'+s+'\n<<':s;}

にしてみました。

また、このブックマークレットで生成された記事にこのブックマークレットで言及すると、タイトル

anond:20070412014506:title=Re:anond:20070330101754:title=Re:そんなあなたに

なんてなってしまいましたが、直す方法がわからずorz

Re:そんなあなたに

もうあるみたい→http://anond.hatelabo.jp/20070211013226

改訂版作りました。返事しつつ好きなタイトル入れられます。

javascript:Yid='あなたのID';d=document;w=window;function bq(s){return '>>\n'+s+'\n<<';}function enc(s){return encodeURIComponent?encodeURIComponent(s):encodeURI(s);}if(d.selection){q=d.selection.createRange().text;}else if(d.getSelection){q=d.getSelection();}else if(w.getSelection){q=w.getSelection();}void(w.open('http://anond.hatelabo.jp/'+Yid+'/edit?title=anond:'+enc(location.href.slice(25,39))+':title=Re:'+d.title+'&amp;body='+enc(bq(q)),'_self',''));

上記のjavascriptの あなたのID 欄をはてラボでのIDに変えれば使えます。

返答したい増田エントリをひとつだけ表示してブックマークレットを実行すると、新しい記事のタイトルが Re:元のタイトル になり、元のエントリトラックバックが飛んで、選択していた領域を引用するように動きます。

2007-03-10

Desperado, why don't you come to your senses

ならず者さん いい加減気付けよ

You've been out ridin' fences,

ずいぶん長い事、塀の見回りだね

for so long - now.

Ohh you're a hard one.

手強い奴だよ

I know that you've got your reasons.

色々わけは、あるんだろうけど

These things that are pleasin'you

お前が、好きでやっていることが、

Can hurt you somehow.

自分の首しめることもあるんだよ

Don't you draw the queen of diamonds boy

ダイアのクイーンをひくのはやめな

She'll beat you if she's able.

お金は、結局お前をダメにする

You know the queen of hearts is always your best bet

頼れるのは、いつだってハートクイーン(愛情)だよ

Now it seems to me, some fine things

オレが見た限り、いいカード

Have been laid upon your table.

君のテーブルにだって、のっかってたんだよ

But you only want the ones

なのに、いつだって君は

That you can't get.

高望み

Desperado,

ならず者さん

Ohhhh you aint getting no younger.

人間、歳はとっていくしかないんだよ

Your pain and your hunger,

その痛みや、満たされない心を抱いて

They're driving you home.

たどり着くのが自分の居場所

And freedom, ohh freedom.

そして、自由、そう自由って奴

Well that's just some people talking.

良く人は口にするけれど

Your prison is walking through this world all alone.

独りこの世界を生きて行くってことが、君の牢屋なのさ

Don't your feet get cold in the winter time?

冬になれば足だって冷たいだろ

The sky won't snow and the sun won't shine.

空から雪も降らないが、太陽も輝かない

It's hard to tell the night time from the day.

夜だか昼だかもよくわからない

And you're losing all your highs and lows

良い思いも、悪い思いもわからなくなる

aint it funny how the feeling goes

変な気分だろ 感情が消えて行くって

away...

Desperado,

ならず者さん

Why don't you come to your senses?

いい加減気付けよ

Come down from your fences, open the gate.

塀から下りて、心のゲートを開けな。

It may be rainin', but there's a rainbow above you.

雨が降っているかもしれないけど。上には、ちゃんと虹が出てるぜ

You better let somebody love you.

誰かに愛されようとしな

(let sombody love you)

(愛されるように)

You better let somebody love you...ohhh..hooo

愛されるように,してみろよ

before it's too..oooo.. late.

手遅れになる前に

2007-03-06

U2 - Walk On

And love is not the easy thing

The only baggage you can bring...

And love is not the easy thing...

The only baggage you can bring

Is all that you can't leave behind

And if the darkness is to keep us apart

And if the daylight feels like it's a long way off

And if your glass heart should crack

And for a second you turn back

Oh no, be strong

Walk on, walk on

What you got, they can't steal it

No they can't even feel it

Walk on, walk on

Stay safe tonight...

You're packing a suitcase for a place none of us has been

A place that has to be believed to be seen

You could have flown away

A singing bird in an open cage

Who will only fly, only fly for freedom

Walk on, walk on

What you got they can't deny it

Can't sell it or buy it

Walk on, walk on

Stay safe tonight

And I know it aches

And your heart it breaks

And you can only take so much

Walk on, walk on

Home...hard to know what it is if you never had one

Home...I can't say where it is but I know I'm going home

That's where the heart is

I know it aches

How your heart it breaks

And you can only take so much

Walk on, walk on

Leave it behind

You've got to leave it behind

All that you fashion

All that you make

All that you build

All that you break

All that you measure

All that you steal

All this you can leave behind

All that you reason

All that you sense

All that you speak

All you dress up

All that you scheme...

http://www.youtube.com/watch?v=NiCpjNSOY2I

2007-02-16

Rimoとかいうサービスが始まったらしいが

チャンネルが「アイドル」「お笑い」「アニメ」「動物」だけじゃ衆愚養成装置じゃないか!

はてな村を世界で一番の村にするためには学しかないのだよ!

もっとOpen Course Wareみたいなのをやらんと駄目でしょうが!

こんな衆愚はてな村を世界に伝えてどうするつもりだ!えぇいもっともっと知的なサービスを用意せい!

村民一体となってはてな村をよくしていく考えがないようじゃ、所詮それまでだ!

衆愚が増えても駄目なんだよ、はてなの場合はね。知的空間はてなはどうした!衆愚はてなを用意したいのかあんたたちは!

はてな台詞なんかもそうだ!酷い有様だ!小さなエンタメは圧倒的多くの人の為にならない!大きなエンタメが出来ないなら大人しく小さくても知的な活動が出来る場を用意すべきだ!

はてな村はどこへ行く!何がはてな村だ!馬鹿村じゃないか!

あんたたちは俺たちのことを考えて俺たちと一緒にはてな村を伝えて行けたらいいなんて言ってやがるが、本当の愛はどこへ行ったんだよ!

ログイン ユーザー登録
ようこそ ゲスト さん