2008-09-01から1ヶ月間の記事一覧

MacBook購入

ついに買いました☆ これで雑になっていた開発環境を統合できる。

prototype.js 分析 $$関数

現段階では使い方のみを理解する findChildElementsメソッドのエイリアスです。 function $$() { return Selector.findChildElements(document, $A(arguments)); } findChildElements: function(element, expressions) { expressions = Selector.split(expre…

prototype.js 分析 Element.Methods

toggle $('test1', 'test2', 'test3')は拡張された要素が配列でかえってくるので、eachで各要素に処理を加えます。 コメントアウトしている箇所は$w関数なので注意。 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> </head></html>

Shallow CopyとDeep Copy

PHP

浅いコピー(Shallow)は参照渡しで深い(Deep)コピーはclone 以下の結果は コンストラクタ 44 - 54デストラクタ デストラクタ となる。コンストラクタは1回しか呼ばれていないが、デストラクタが2回あるのは、cloneで作成したオブジェクトが新しいメモリ領域を…

enum

C++

連想配列みたいに使用できる #include <iostream> using namespace std; int main(){ enum color{red, yellow, green}; enum color col = green; char *c[] = {"red", "yellow", "green"}; cout << c[col]; return 0; } c++への目次</iostream>

リーマン破綻

ビックリした。 けれど、処理速度ものすごい早い?日本みたいにダラダラはやっていない印象を受ける。

Unix/Linuxプログラミング

もっともっと深くへ。。 学習の目次 moreを書く cpを書く 端末制御とシグナル forkについて 参考書籍 第1章 Unixシステムプログラミングの全体像 第2章 ユーザー、ファイル、マニュアル─最初はwhoから 第3章 ディレクトリとファイルのプロパティ─lsを徹底的…

ファイルまわり

変数宣言した時に*str="hogehoge"とするのは便利だけど、宣言する時だけしかできないのかな。。 以下、EOFの時はfgets()がNULLなのでwhile文が実行されず、「Complete」の部分は出力されません 追記:strcpyとmallocを使えば良いと気づきました。 #include <stdio.h> </stdio.h>…

段組を理解するためのサンプルコード

CSS

これをいじり倒しましょう <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" /> <title>sample site</title> <…</meta></head></html>

ブロックレベル要素13個

CSS

インライン要素と対をなすブロックレベル要素 要素 用途 h1〜h6 見出し p 段落 div 任意の範囲・グループ blockquote 引用文 address 連絡先 pre 整形済みテキスト ul リスト ol リスト dl 定義リスト table テーブル form フォーム fieldset フォーム内容の…

CSSの目次

CSS

XHTMLとCSSを一度きちんと整理しようと思いました。 XHTMLのブロックレベル要素 IEではDOCTYPE宣言がないとCSSがうまく動かない。。 こいつね 段組を理解するためのサンプルHTML

ポインタを返す関数

strcatの自作 #include <stdio.h> #include <string.h> char *mystrcat(char *, char *); int main(void){ char str1[16] = "hoge"; char *str2 = "moge"; printf("%s\n", mystrcat(str1, str2)); return 0; } char *mystrcat(char *a, char *b){ char *p; int n = 0; p = a + s</string.h></stdio.h>…

prototype.js分析 $w()関数

用例2 処理を加えた結果が欲しいのでcollect()を使ってarrayに収める。処理を加えるだけの場合はeach()を使う、と。 <script src="prototype1.6.js"></script> <script> function $(element){ if(arguments.length > 1){ for(var i=0, elements = [], length = arguments.length; i

prototype.js分析 $w()関数

用例 perlのqwみたいなの。 <script> String.prototype.strip = function(){ return this.replace(/^\s+/, '').replace(/\s+$/, ''); } function $w(string){ string = string.strip(); return string ? string.split(/\s+/) : []; } console.log(" hoge moge ".stri…

prototype.js分析 $()関数

用例 引数は複数あっても大丈夫、と。 <script src="prototype1.6.js"></script> <script> function $(element){ if(arguments.length > 1){ for(var i=0, elements = [], length = arguments.length; i

コンストラクタ

C++

例文 #include <iostream> using namespace std; class myclass{ int a; public: myclass(); void show(); }; myclass::myclass(){ cout << "load constructer\n"; a = 10; } void myclass::show(){ cout << a << "\n"; } int main(){ myclass obj; obj.show(); return</iostream>…

クラスの基本

C++

メンバは非公開 #include <iostream> using namespace std; class Foo{ int a; public: void set_a(int num); int get_a(); }; void Foo::set_a(int num){ a = num; } int Foo::get_a(){ return a; } int main(){ Foo obj1, obj2; obj1.set_a(100); obj2.set_a(200); c</iostream>…

gccでコンパイル

C++

注意点 「gcc --version」でコンパイラのバージョンチェック 「gcc -o test test.cpp -lstdc++」でコンパイルtestは実行ファイルで./testで実行、test.cppはソースファイル #include の次にusing namespace std;を記述しないと駄目みたい。。 #include <iostream> usin</iostream>…

C++の目次

C++

学習Tips gccでC++ クラス 基本 コンストラクタ いろいろ enum

構造体

メンバに同じ型へのポインタを持つ #include <stdio.h> typedef struct STUDENT{ char *name; int age; struct STUDENT *next; }DATA; int main(void){ DATA taro = {"TARO", 16}; DATA jiro = {"JIRO", 15}; DATA hana = {"HANA", 14}; DATA *p; taro.next = &jiro; </stdio.h>…

構造体

typedefを使う #include <stdio.h> typedef struct STUDENT{ char *name; int age; }MYDATA; void SirYesSir(MYDATA *); int main(void){ MYDATA taro; MYDATA *p; p = &taro; taro.name = "TARO"; taro.age = 22; printf("%s - %d\n", taro.name, taro.age); SirYesS</stdio.h>…