はてなキーワード: byteとは
sizeof(MotionState) = 0xa8 +0x00 byte ? +0x01 byte ? +0x02 byte ? +0x03 byte ? +0x04 short x_offset; +0x06 short y_offset; +0x08 short duration; +0x0a short imageNumber; +0x0c short transform_origin_x; +0x0e short transform_origin_y; +0x10 short tex_width; +0x12 short tex_height; +0x14 byte blend_mode; +0x15 BAADF00D (3) +0x18 RenderInfo* type2; +0x1c short damage; +0x1e short proration; +0x20 short guard_damage; +0x22 short spirit_damage; +0x24 short untech; +0x26 short damage_motion_percentage; +0x28 short limit; +0x2a short self_hitstop_hit; +0x2c short enemy_hitstop_hit; +0x2e short self_hitstop_guard; +0x30 short enemy_hitstop_guard; +0x32 short cardgain_hit; +0x34 short cardgain_guard; +0x36 short hit_effect_air; +0x38 short hit_effect_ground; +0x3a BAADF00D (2) +0x3c float velocity_x; +0x40 float velocity_y; +0x44 short sound_type; +0x46 short effect_type; +0x48 byte attack_level; +0x49 byte combo_correction; +0x4a BAADF00D (2) +0x4c uint fflags; +0x50 uint aflags; +0x54 Rect* collision; +0x58 BAADF00D (4) +0x5c Rect* hitboxes; +0x60 Rect* hitboxes_end; +0x64 Rect* hitboxes_end; +0x68 BAADF00D (4) +0x6c Rect* attackboxes; +0x70 Rect* attackboxes_end; +0x74 Rect* attackboxes_end; +0x78 BAADF00D (4) +0x7c void* ? +0x80 void* ? +0x84 void* ? +0x88 short ? +0x8a short ? +0x8c byte ? +0x8d byte ? +0x8e byte ? +0x8f byte ? +0x90 void* ? +0x94 void* ? +0x98 short ? +0x9a short ? +0x9c byte ? +0x9d byte ? +0x9e byte ? +0x9f byte ? +0xa0 short ? +0xa2 short ? +0xa4 short ? +0xa6 BAADF00D (2)
platinumで吐き出せるFMFを読み取るためクラスを置いておく。特に反省はしてない。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Data; namespace RPG { class MapFile { //FMFファイルのヘッダー struct FMFHeader { public string dwIdentifier; // ファイル識別子 'FMF_' public int dwSize; // ヘッダを除いたデータサイズ public int dwWidth; // マップの横幅 public int dwHeight; // マップの高さ public byte byChipWidth; // マップチップ1つの幅(pixel) public byte byChipHeight; // マップチップ1つの高さ(pixel) public byte byLayerCount; // レイヤーの数 public byte byBitCount; // レイヤデータのビットカウント } private FileStream fs; private BinaryReader br; private FMFHeader _head; private byte[] _data8 = null; private short[] _data16 = null; public int width { get { return _head.dwWidth; } } public int height { get { return _head.dwHeight; } } public int chip_width { get { return _head.byChipWidth; } } public int chip_height { get { return _head.byChipHeight; } } //マップファイルを読み込む。 //エラーが起きた場合は例外を投げます public void Load(String fname) { try { fs = new FileStream(fname, FileMode.Open); br = new BinaryReader(fs); //識別子を確認する _head.dwIdentifier = new String(br.ReadChars(4)); if (_head.dwIdentifier != "FMF_") { throw new Exception("ファイルが壊れています"); } //ヘッダーの残りの情報を読み込む _head.dwSize = br.ReadInt32(); _head.dwWidth = br.ReadInt32(); _head.dwHeight = br.ReadInt32(); _head.byChipWidth = br.ReadByte(); _head.byChipHeight = br.ReadByte(); _head.byLayerCount = br.ReadByte(); _head.byBitCount = br.ReadByte(); switch (_head.byBitCount) { case 8: //8bit layer _data8 = br.ReadBytes(_head.dwSize); break; case 16: //16it layer int count = _head.dwSize / 2; _data16 = new short[count]; for(int i = 0; i < count; i++) _data16[i] = br.ReadInt16(); break; } } catch(Exception ex) { throw ex; } finally { br.Close(); } } //マップファイルを閉じます public void close() { //読み込んだデータを破棄する _data8 = null; _data16 = null; } //マップファイルからチップ番号を取得します public int getValue(int layer_index, int x, int y) { if (_data8 == null &amp;&amp; _data16 == null) return -1; if (layer_index >= _head.byLayerCount || x >= _head.dwWidth || y >= _head.dwHeight) return -1; int index = 0; int layer_offset = getLayerAddr(layer_index); switch (_head.byBitCount) { case 8: //8bit layer index = _data8[layer_offset + x + y * _head.dwWidth]; break; case 16: //16it layer index = _data16[layer_offset + x + y * _head.dwWidth]; break; } return index; } //該当レイヤーが存在する_dataのindexを返す private int getLayerAddr(int layer_index) { if (layer_index >= _head.byLayerCount || (_data8 == null &amp;&amp; _data16 == null)) return -1; return _head.dwWidth * _head.dwHeight * layer_index; } } }
#訂正
某プロバイダDとNTTのBフレッツでつなげてる自宅鯖で、合法的なisoイメージのbittorrent seederをやってみた。
周囲の迷惑もあるかなと思って、ピーク流量が1,000K[byte/sec] になるよう制限した。
昨日1日でだいたい平均 500K[byte/sec]の転送があったみたいだ。
Bフレッツだぜ? 光だぜ? 100Mだとか言ってるんだぜ? 余裕余裕。
で、これが月でどれくらいの転送量になるのか計算してみたんだ。
0.5M[byte/sec]*60[sec/min]*60[min/h]*24[h/day] = 43,200M[byte/day]
43.2G[byte/day]*30[day/month] = 1,296G[byte/day]
月1.3テラバイトとか! ちりも積もれば山となるな。
さてここで問題です。俺はこの調子でbittorrentを回し続けても大丈夫なのでしょうか。
また調子こいてピーク流量の制限をもっとゆるくしても平気でしょうか。
他の人が使ってるプロバイダだったらどう?
"What Is Web 2.0" Tim O'Reilly 2005/9/30
http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html
Core Competencies of Web 2.0 Companies
In exploring the seven principles above, we've highlighted some of the principal features of Web 2.0. Each of the examples we've explored demonstrates one or more of those key principles, but may miss others. Let's close, therefore, by summarizing what we believe to be the core competencies of Web 2.0 companies:
- Services, not packaged software, with cost-effective scalability
- Control over unique, hard-to-recreate data sources that get richer as more people use them
- Trusting users as co-developers
- Harnessing collective intelligence
- Leveraging the long tail through customer self-service
- Software above the level of a single device
- Lightweight user interfaces, development models, AND business models
ノイズを除去してまとめれば、要するに相互接続性を確保したWebサービスのことだ。
そしてそう言えばいいのである。
「どんなデータベース資産を蓄積してるんだい?」とかアホと違うか。外部から利用できないならそんなのどうでもいいんだよ。ソフトウェアをそのByte量で評価するのと変わらん。大きいコードにはいっぱい機能が詰まってるはずだみたいな。
結局分かってないから適切な表現ができないのだろう。
それに言ってること微妙に変えてないか、こいつ。
'/** 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