2012年8月28日火曜日

POI

http://books.google.co.jp/books?id=wbfV_-pJklUC&pg=PA307&lpg=PA307&dq=setrowstyle+poi&source=bl&ots=hE9N-L08MH&sig=8F_RN6c6AFKqoXEIzi7KnmRAn3c&hl=ja#v=onepage&q=setrowstyle%20poi&f=false

P.312

合計値

cell.setCellFormula("SUM(D3:D7)");

303~


Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space


http://houseofinukoi.blog.fc2.com/blog-entry-169.html

http://tk-factory.net/wordpress/?p=1506


http://atmarkplant-dj.blogspot.jp/2011/04/apache-poijava-excel-1.htm



こんなこと書いたら、こんなふうになります。


for(int i = 0; i < 500 ; i++){
Row row = sheet.createRow(10);
Cell cell = row.createCell(i);
cell.setCellValue("?");
cell.setCellStyle(style2);
}


java.lang.IllegalArgumentException: Invalid column index (256). Allowable column range for BIFF8 is (0..255) or ('A'..'IV')l


http://www.javadrive.jp/poi/style/index14.html

2012年8月25日土曜日

Slidrop



なぜか急にランクインしてた。

ちなみに、2012年3月には既に記事の紹介は行われていた。
http://www.lifehacker.jp/2012/03/120310slidrop2.html

そして公式。
http://slidrop.com/

生まれた背景 by TechWave
http://techwave.jp/tag/slidrop

2012年8月18日土曜日

☆500 Error: Cannot find module 'ejs'



$ node app.js
Express server listening on port 3000
Error: Cannot find module 'ejs'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at new View (/Users/Junichi/node_modules/express/lib/view.js:42:49)
    at Function.app.render (/Users/Junichi/node_modules/express/lib/application.js:486:12)
    at ServerResponse.res.render (/Users/Junichi/node_modules/express/lib/response.js:677:7)
    at exports.index (/Users/Junichi/node/routes/index.js:7:7)
    at callbacks (/Users/Junichi/node_modules/express/lib/router/index.js:165:11)
    at param (/Users/Junichi/node_modules/express/lib/router/index.js:139:11)
↓
とのことで
↓

hmm it kinda looks like it's using a globally installed express..(https://github.com/visionmedia/express/issues/910)
↓
からの
↓
sudo npm install -g express
↓
/usr/local/bin/express -> /usr/local/lib/node_modules/express/bin/express
↓
node app.js
↓

500 Error: Cannot find module 'ejs'

↓
・・・( ゚д゚)ハア!?

ちなみに、
ecpress --versiion →3.0.0rc3
node -v →v0.8.5

というか、express、グローバルに入れてからアプリケーションの作成してないよね
↓
で、アプリ作成したかったけどコマンド忘れたから作り方見ようとネットを探してると・・・
↓
「ls node_module」というコマンドを発見
↓打ってみる
$ ls node_modules/
ejs socket.io twitter-node
↓
・・・ejsあるけど、expressないやん。
↓
npm install express
↓
$ ls node_modules/
↓
ejs express socket.io twitter-node
↓
ほいさ。
↓
からの
↓
JK:node Junichi$ express -t ejs test

   create : test
   create : test/package.json
   create : test/app.js
   create : test/public
   create : test/public/javascripts
   create : test/public/images
   create : test/public/stylesheets
   create : test/public/stylesheets/style.css
   create : test/routes
   create : test/routes/index.js
   create : test/views
   create : test/views/layout.jade
   create : test/views/index.jade

   install dependencies:
     $ cd test && npm install

   run the app:
     $ node app
↓
(・・・jade入ってるし・・・)
↓
とりあえずweb開いてみる
↓

500 Error: Cannot find module 'jade'

  • at Function.Module._resolveFilename (module.js:338:15)
  • at Function.Module._load (module.js:280:25)
  • at Module.require (module.js:362:17)
  • at require (module.js:378:17)
  • at new View (/Users/Junichi/node/node_modules/express/lib/view.js:42:49)
  • at Function.app.render (/Users/Junichi/node/node_modules/express/lib/application.js:486:12)
  • at ServerResponse.res.render (/Users/Junichi/node/node_modules/express/lib/response.js:677:7)
  • at exports.index (/Users/Junichi/node/test/routes/index.js:7:7)
  • at callbacks (/Users/Junichi/node/node_modules/express/lib/router/index.js:165:11)
  • at param (/Users/Junichi/node/node_modules/express/lib/router/index.js:139:11)
・・・んだ。
↓
とりあえず、ejsで入るように入れ直して見る。
↓
$ express -tejs test

   create : test
   create : test/package.json
   create : test/app.js
   create : test/public
   create : test/public/javascripts
   create : test/public/images
   create : test/public/stylesheets
   create : test/public/stylesheets/style.css
   create : test/routes
   create : test/routes/index.js
   create : test/views
   create : test/views/index.ejs

   install dependencies:
     $ cd test && npm install

   run the app:
     $ node app
↓
で
↓
localhost:3000
↓
キタ━━━━(゚∀゚)━━━━!!

<hr>
【結果と考察】
500 Error: Cannot find module 'ejs'は、
グローバルに入ってない系。
で、グローバルに入れ直したらアプリケーション、作りなおして下しあ。



2012年8月17日金曜日

node+

node-devはデバッグ用のnodeの代替コマンドで、ファイル更新時の再起動が必要なくなってます。
なんだってー(;´Д`)。

何か色々怒られた


JK:tw Junichi$ node app.js
Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:

  var express = require("express");
  var app = express();

Socket.IO's `listen()` method expects an `http.Server` instance
as its first parameter. Are you migrating from Express 2.x to 3.x?
If so, check out the "Socket.IO compatibility" section at:
https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x
   info  - socket.io started

/Users/Junichi/node/tw/app.js:41
track:[https]//
      ^
ReferenceError: https is not defined
    at Object.<anonymous> (/Users/Junichi/node/tw/app.js:41:9)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

2012年8月15日水曜日

自宅Mac

1.Scienticic Linuxインストール
http://fakeyakuza.hatenablog.com/entry/20110914/1316013181
→miniCDインストール×
→色々×
→i86_63を試すもダメ
→i368を試すもダメ。
【解決策】"PAE/NXを有効化"にチェック=>(http://d.hatena.ne.jp/esperia/20110607/1307434536
→一旦通るようになった。(i368)
↓
network-scriptの設定
→pingが通らない
↓
【ネットワーク初期設定(http://www.server-world.info/query?os=Scientific_Linux_6&p=initial_conf&f=3)】
/etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO="dhcp"
ONBOOT="yes"
/etc/rc.d/init.d/network restart
chkconfig network on
↓
【SELINUX無効化】
getenforce←SELINUX状態[Enforceing:有効 Permissing:無効]
getenfort←SELINUX無効化
or
vi /etc/sysconfig/selinux
SELINUX=disabled
↓
【iptable無効化】
/etc/rc.d/init.d/iptables stop
chkconfig iptables off
↓
【nginx】

wgetがない→sudo yum install wget
↓
こっちのほうが早い(http://sakura.off-soft.net/centos/apache-nginx-1-rpm-nginx-install.html)
↓開けない
openssh?
↓
(解決策!)
http://blog.kanemu.net/2009/04/virtualboxcentos.html
ブリッジネットワーク。だと、SSHいらない。
で、いつもどおりudevでeth3を変えてやる。
↓
・・・できない。

【wget】
http://d.hatena.ne.jp/qloog/20100410/1270827611

(8.15/1:26)
ネットはある。
あとは。。。


JK:‾ Junichi$ ssh root@192.168.56.101
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
43:7b:84:91:1c:98:35:50:12:d8:af:29:d0:6a:82:2e.
Please contact your system administrator.
Add correct host key in /Users/Junichi/.ssh/known_hosts to get rid of this message.
Offending key in /Users/Junichi/.ssh/known_hosts:9
RSA host key for 192.168.56.101 has changed and you have requested strict checking.
Host key verification failed.
JK:‾ Junichi$ 
↓
ちゅーから
↓
JK:‾ Junichi$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/Junichi/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/Junichi/.ssh/id_rsa.
Your public key has been saved in /Users/Junichi/.ssh/id_rsa.pub.
The key fingerprint is:
f1:be:a3:e5:15:bd:c3:bd:5d:9a:fa:a3:ca:dd:85:d1 Junichi@JK.local
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|        .        |
|         o   . . |
|        S . . o E|
|         .   o = |
|          o . = +|
|         +.+ ..=+|
|        ..=o++=o.|
+-----------------+
JK:‾ Junichi$
↓からの
ssh root@192.168.56.101
↓で
結局さっきと一緒。
↓で
よく見ると、「Offending key in /Users/Junichi/.ssh/known_hosts:9」
って言ってるから、なんとなく消してみる。
↓もっかい
ssh root@192.168.56.101
↓
動いた!!!!!
↓からの
日本語文字化けorz
→ここまで。
☆参照<http://azurite.espel.jp/index.php/2011/04/03/sakuravps-mac-ssh/>

2012年8月13日月曜日

node製

★監視ツール
http://d.hatena.ne.jp/fat47/20120424/1335232922

csv

★参考:http://www.hacksparrow.com/handle-file-uploads-in-express-node-js.html
★mysqlから直接csv読み込んでinsert
http://sasuke.main.jp/sqlcsv.html

//**//
//こっからFileUpload
//
app.post('/file-upload',function(req, res, next){
        console.log('req.body:',req.body);
        console.log('req.files',req.files);
        console.log(req.files[path]);
        console.log(req.files[1]);
        console.log(req.files.path);
        console.log(req.files.thumbnail.path);
     
        drop = 'DROP TABLE csv;';
        connection.query(drop,function(err,results,fields){
          console.log(drop);
        });
               create = 'CREATE TABLE csv(strEmpNo VARCHAR(10) PRIMARY KEY NOT NULL,intNo TINYINT,strEmail VARCHAR(100),strPost VARCHAR(100),intEmpKbn TINYINT(10),strFurigana1 VARCHAR(30),strNaisen VARCHAR(20),strTel VARCHAR(20),strHP_Email VARCHAR(50),strIDMNo VARCHAR(20),strCarrier VARCHAR(10),strModel VARCHAR(10),intDel TINYINT,intUpdFlg TINYINT,strUPDT VARCHAR(30));';
        connection.query(create,function(err,results,fields){
          console.log(create);
        });

        insert = "LOAD DATA INFILE ? INTO TABLE csv FIELDS TERMINATED BY ',' ENCLOSED BY '' ";
        var obj = req.files.thumbnail.path;
        connection.query(insert,obj,function(err,results,fields){
          console.log(insert);
          res.redirect('/');
        });
        //
        //csv().formPath(req.files.).on('data',function(data){
        //      console.log(data[0]);
        //})
});

次の開発で使うかも

http://d.hatena.ne.jp/esperia/20100627/1277628374

家の...

環境でやろうとすると、こうなるんだよな・・・


Error: Cannot find module 'ejs'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at new View (/Users/Junichi/node_modules/express/lib/view.js:42:49)
    at Function.app.render (/Users/Junichi/node_modules/express/lib/application.js:486:12)
    at ServerResponse.res.render (/Users/Junichi/node_modules/express/lib/response.js:677:7)
    at exports.index (/Users/Junichi/node/HelloEjs/routes/index.js:7:7)
    at callbacks (/Users/Junichi/node_modules/express/lib/router/index.js:165:11)
    at param (/Users/Junichi/node_modules/express/lib/router/index.js:139:11)
GET / 500 40ms


2012年8月9日木曜日

login

★express:http://hideyukisaito.github.com/expressjs-doc_ja/guide/
★node-メソッドの変更:http://dameninngenn.sblo.jp/article/43982874.html
★POSTの問題:http://havelog.ayumusato.com/develop/javascript/e214-express_post_params.html
=>ぶっちゃけ、app.useとかの定義をPOSTのやつより先に書いて(移動して)やったら普通に動いた。
★res.session:http://memo.yomukaku.net/entries/280

(☆動画アップロード:http://blog.fukaoi.org/2012/02/01/node-video-upload)
(★すクリーピングhttp://shimz.me/blog/?p=19)



connection.query('SELECT * FROM login',function(err,results,fields){
        if (err) throw err;
        console.log('Query result:',results);
        console.log('なんでも:',results[0].id);
        console.log('test1:',results[0].password);
});
この
resultsは全件持ってる。
results[0].idで、0件目のidに関して取ってくる。

また、変数の代入は
var id = results[0].id
と、”=”でいける。


----
ー「amidn追加時」
md5
https://github.com/pvorb/node-md5

【インストール】
npm install MD5
*Enderは謎。(ender build MD5)
【使い方】(公式に書いてるまんま)

var md5 = require('MD5');

console.log(md5("message"));

 This will print:
78e731027d8fd50ed642340b7c9a63b3


-----------------------------------------------------
Error: listen EADDRINUSE
ー別プロセスで、同じものが走ってる。


node+mysql


/**
 * Mysql
 * 公式(mysql@2.0.0-alpha3)
 */
var mysql = require('mysql');
var connection = mysql.createConnection({
        host:'localhost',
        user:'root',
        password:'',
        database:'node'
});
connection.connect();

connection.query('SELECT * FROM login',function(err,results,fields){
        if (err) throw err;
        console.log('Query result:',results);
});
//connection.end();
--------------------------------------------------------------------
公式だと、https://github.com/felixge/node-mysql/

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'me',
  password : 'secret',
});

connection.connect();

connection.query('SELECT 1', function(err, rows, fields) {
  if (err) throw err;

  console.log('Query result: ', rows);
});

connection.end();

だけど、使うDBをvar connectioの中に書いてやって、クエリの発行connection.queryのSELECT 1に使いたいクエリの発行、(ここではSELECT * FROM login)をかいてヤル。


ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

/*ブログあたり(mysqlのvesion不明。)*versionあげたら動かなくなった:"has no method 'createClient'"
var mysqlConfig = {'host':'localhost','user':'root','password':'','database':'node'};
var mysqlClient = mysql.createClient(mysqlConfig);
global['mysqlClient'] = mysqlClient;

var Client = mysql.createClient({user:'root', password:''});
Client.query('use node');

Client.query('select * from node',function myCallback(err,result,fields){
        console.log(result);
});
*/

TABLE


DROP TABLE login;

SHOW TABLES;

CREATE TABLE login(
id VARCHAR(50) NOT NULL,
password VARCHAR(20) NOT NULL
);


SHOW TABLES;

DESC login;

INSERT INTO login(id,password)
VALUES ('jk','junichi');

謎のメール


mysql> :q
    -> \q
Bye
新しいメールが /var/spool/mail/root にあります
[root@host1 app1]# cat /var/spool/mail/root                              
From root@host1.localdomain  Wed Aug  1 17:43:05 2012
Return-Path: <root@host1.localdomain>
X-Original-To: root
Delivered-To: root@host1.localdomain
Received: by host1.localdomain (Postfix, from userid 0)
        id 74A0611D0; Wed,  1 Aug 2012 17:43:05 +0900 (JST)
Date: Wed, 01 Aug 2012 17:43:04 +0900
To: root@host1.localdomain
Subject: YUM:host1:2012-08-01
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20120801084305.74A0611D0@host1.localdomain>
From: root@host1.localdomain (root)

 --------------------
 YUM - security
 --------------------
Error: Cannot retrieve repository metadata (repomd.xml) for repository: sl. Please verify its path and try again


From root@host1.localdomain  Mon Aug  6 11:13:52 2012
Return-Path: <root@host1.localdomain>
X-Original-To: root
Delivered-To: root@host1.localdomain
Received: by host1.localdomain (Postfix, from userid 0)
        id 8325E2BE2; Mon,  6 Aug 2012 11:13:52 +0900 (JST)
Date: Mon, 06 Aug 2012 11:13:52 +0900
To: root@host1.localdomain
Subject: YUM:host1:2012-08-06
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20120806021352.8325E2BE2@host1.localdomain>
From: root@host1.localdomain (root)

 --------------------
 YUM - security
 --------------------

================================================================================
 Package         Arch       Version                       Repository       Size
================================================================================
Updating:
 dhclient        x86_64     12:4.1.1-31.P1.el6_3.1        sl-security     316 k
 dhcp-common     x86_64     12:4.1.1-31.P1.el6_3.1        sl-security     139 k

Transaction Summary
================================================================================
Upgrade       2 Package(s)

Total download size: 455 k

Updated:
  dhclient.x86_64 12:4.1.1-31.P1.el6_3.1                                      
  dhcp-common.x86_64 12:4.1.1-31.P1.el6_3.1                                    



From root@host1.localdomain  Thu Aug  9 10:18:45 2012
Return-Path: <root@host1.localdomain>
X-Original-To: root
Delivered-To: root@host1.localdomain
Received: by host1.localdomain (Postfix, from userid 0)
        id 500E02BDF; Thu,  9 Aug 2012 10:18:45 +0900 (JST)
Date: Thu, 09 Aug 2012 10:18:44 +0900
To: root@host1.localdomain
Subject: YUM:host1:2012-08-09
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20120809011845.500E02BDF@host1.localdomain>
From: root@host1.localdomain (root)

 --------------------
 YUM - security
 --------------------

================================================================================
 Package        Arch         Version                    Repository         Size
================================================================================
Updating:
 openldap       x86_64       2.4.23-26.el6_3.2          sl-security       261 k

Transaction Summary
================================================================================
Upgrade       1 Package(s)

Total download size: 261 k

Updated:
  openldap.x86_64 0:2.4.23-26.el6_3.2                                          



[root@host1 app1]# ^C  

2012年8月8日水曜日

mail


//モジュールロード
var nodemailer = require("nodemailer");
//埋め込み画像のファイル名に使用
//var cid = Date.now()+".image.png";

//SMTPサーバーの設定
nodemailer.SMTP = {
        host: "mail.c",
port:587,
//      ssl:true,
        use_authentication:true,
       user:"kawamoto_junichi@c",  
     pass:""
};

//メール情報の作成
var message = {      
sender:'kawamoto_junichi@c',
       to:'',
       subject:'【必ず読んでください】WindowsログインID変更のお知らせ!!!',    
  body:"Hello to myself",  
    html:"各位<br>8/11(土)WinodwsIDを社員番号へ変更を致し>ます。<br>■注意意!<br>WindowsID変更後は、必ず再起動を行ってください。",
debug:true
};

//メール送信のコールバック関数
var callback = function(error, success){      
if(error){              
 console.log("Error occured");  
             console.log(error.message);  
            return;  
     }      
 if(success){  
            console.log("Message sent successfully");
        }else{
                console.log("Message failed,reschedule!");        }
};

//メール送信
var mail;
try{
        mail = nodemailer.send_mail(message, callback);
}catch(e){
        console.log("Caught Exception", e);
}



mysqlが立たない


120808 18:06:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120808 18:09:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120808 18:09:17  InnoDB: Initializing buffer pool, size = 2.0G
120808 18:09:17  InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 640 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 65536 pages, max 0 (relevant if non-zero) pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
120808 18:09:17 [ERROR] Plugin 'InnoDB' init function returned error.
120808 18:09:17 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120808 18:09:17 [ERROR] Unknown/unsupported table type: innodb
120808 18:09:17 [ERROR] Aborting

120808 18:09:17 [Note] /usr/libexec/mysqld: Shutdown complete

2012年8月7日火曜日

node実装

(メモ)
cloud9
http://codedehitokoto.blogspot.jp/2012/01/nodeidecloud9.html
チュート★★★
http://sakuratan.biz/archives/3101
設定ファイル
http://d.hatena.ne.jp/sugyan/20110603/1307064303
★
http://updoor.com/2011/11/node-js%E3%81%8B%E3%82%89mysql%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E3%81%BF%E3%82%8B/
[innoDBエラーのやつ]
★http://memo.yomukaku.net/entries/279
★http://d.hatena.ne.jp/S_a_k_U/20110703
★http://ogawa.s18.xrea.com/tdiary/20060215.html

[ちゃっと]
★http://wise9.jp/archives/4218

「ポストとゲット」
http://d.hatena.ne.jp/replication/20110307/1299451484

[hint]モジュール

(要件)
ログイン画面

mysql接続
http://nantekottai.com/2011/08/15/node-mysql/
http://updoor.com/2011/11/node-js%E3%81%8B%E3%82%89mysql%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E3%81%BF%E3%82%8B/

メール送信
http://dev.classmethod.jp/server-side/node-mail/
http://spagetty.hatenablog.com/entry/20110321/1300720832
http://blog.araishi.com/node-js-mail-sender/

【IDE】
 http://codedehitokoto.blogspot.jp/2012/01/nodeidecloud9.html

(導入編)
【node】
 express入れたいと思うじゃん。→npmが無くて怒られます。
 ↓
 wget http://nodejs.org/dist/v0.8.5/node-v0.8.5.tar.gz
 (こいつから→http://nodejs.jp/)
 ↓
(追記!)
 tar zxvf node-v0.8.5.tar.gz
 cd node-v0.8.5
 ./configure
 make(大体10分そこいらで終わる)
 sudo make install
 node -v
↓
【npm】
 curl http://npmjs.org/install.sh | sh
 (curl入ってないですよーって怒られた人は)yum install curl
 npm -v
↓
【express】
 npm install express -g
 express --version
 (Tips:バージョン指定はexpress@バーションと指定)
↓
【ひな形作成】
 express -tejs app1
 cd app1
 npm install express ejs socket.io (*mysql)


【Bootstrap】
 http://kikki.hatenablog.com/entry/2012/04/04/000116
 <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"/>
↓
【nodeファイルの作成】
 フツーにjsファイルを作成してnodeの書き方してやればいい。

フォームについて
 http://st.ik.am/form-maker/form/


【mail】
送信できないっていうね。。。
http://codedehitokoto.blogspot.jp/2012/04/nodejs_30.html
断念...
http://dev.classmethod.jp/server-side/node-mail/
これ、エラーでるんですよねー・・・portのところあたりで
↓
頑張ればなんとかいけます。
http://dev.classmethod.jp/server-side/node-mail/



これをやりたかった
http://updoor.com/2011/11/node-js%E3%81%8B%E3%82%89mysql%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E3%81%BF%E3%82%8B/

【ERROR】
(mysql)
plugin 'innodb' init function returned error
vim /var/log/mysqld.log
[ヒント]
http://d.hatena.ne.jp/Loups-garous/20080926
http://www.l2tp.org/?p=991

【mongoはこっち】
http://blog.livedoor.jp/ishiduca/archives/51153130.html
//MongoDBの設定
var mongoose = require('mongoose').Mongoose;
//mydb(database)への接続
var db = mongoose.connect('mongodb://localhost:27017/mydb');

mysql起動
/etc/rc.d/init.d/mysqld start

★npm -g install mysql

【node-mysql sample】
★http://dev.classmethod.jp/etc/node-js-module-mysq/
(一応公式:https://github.com/felixge/node-mysql/)
✕http://updoor.com/2011/11/node-js%E3%81%8B%E3%82%89mysql%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E3%81%BF%E3%82%8B/
(接続自体はこれで)
|var mysql = require(mysql');
|var TABLE = 'bookmarks';
|var client = mysql.createClinet({
| user:'root',
| password:'',
| database:'NODEdb'
|});
|client.query(
| 'select * from '+TABLE, (*fromの後に半角スペースがいる)
| function (err, result)|
| if(err){
| throw err;cd
| }
| console.log(result);
| console.log(field);←お好みで
| client.end();
| }
|);

ところで。。。
フォームってどうするんだ?


2012年8月3日金曜日

動作確認

nginx
/usr/share/nginx/html

ネットワーク
/etc/sysconfig/network-script/ifcfg-eth2
BOOTPROTO="dhcp"

*
yumでNginxをインストールすると標準で起動スクリプトがインストールされますが、Passengerからインストールするとスクリプトがありませんので、作成します。基本的には公式サイトの記述を参考にします。
http://akibe.com/centos-setup-21-nginx/
↓
http://wiki.nginx.org/RedHatNginxInitScript

wiki
http://www26.atwiki.jp/nginx/


/etc/nginx/nginx.conf
(http://taichino.com/engineer-life/linux/2170)

sudo service mysqld start

udevの話
http://luna2-linux.blogspot.jp/2011/08/centos-60-nic-ethx.html



/etc/sysconf/networek-script/ifcfg-eth2
BOOTPROTO="dhcp


MACアドレスを変えてservice networkをリスタートした時に起きる問題
↓
ifconfig で表示されなくなる。
↓
udev
↓
/etc/udev/rules.d/70-persistent-net.rules
↓
こいつに、新しくMACアドレスをVMの設定から当てたやつを参考に
おのおのアドレスが当たっているところにNAME="eth"の番号を振ってやる。
↓
host2,3のeth2ともに、inet addr:192.168.56.101と2が振られた
↓
で?



【nginx】
http://www26.atwiki.jp/nginx/pages/14.html
http://www.happytrap.jp/blogs/2012/02/23/8243/
http://abeerforyou.com/?p=391


【ロードバランサー系】
http{server{のやつ}}
http://wiki.nginx.org/NginxLoadBalanceExample


【Node】
nave
http://www.atmarkit.co.jp/fwcr/rensai2/nodejs02/01.html



【レプリケーション系】
レプリケーションはるときに、eth1を設定していなかったからこれで。
/etc/sysconfig/network-scripts/ifcfg-eth1
BOOTPROTO="static"
IPADDR="198.168.x.x"
http://www.obenri.com/_minset_wbel3/netconfig_wbel3.html
ネットワーク系詳細=>http://d.hatena.ne.jp/bojovs/20081020/1224429418

レプリケーションの設定(SQL)
http://wadslab.net/wiki/index.php?MySQL%20%A5%EC%A5%D7%A5%EA%A5%B1%A1%BC%A5%B7%A5%E7%A5%F3%A4%CE%A5%BB%A5%C3%A5%C8%A5%A2%A5%C3%A5%D7%BC%EA%BD%E7


http://tech.hitsug.net/?CentOS%2FMySQL%2F%E5%88%9D%E6%9C%9F%E8%A8%AD%E5%AE%9A


環境説明

-nginx
【成功例:FastMail.FM | Wordpress.com】
HTTPとリバースプロキシのサーバーで、メールプロキシサーバーでもあります。
>プロキシ


-innodb
 -トランザクションイノロック

-レプリケーション

-Collation

2012年8月1日水曜日

環境構築



ERMaster  =>  http://ermaster.sourceforge.net/index_ja.html
JMater   =>  http://d.hatena.ne.jp/language_and_engineering/20081014/1223905380

VirtualBox  内部 =>http://linux2.g.hatena.ne.jp/lnznt/20120131/1328021979

Scientific Linux  = > http://ftp.riken.jp/Linux/scientific/6/x86_64/iso/

Openssh  => http://kazmax.zpp.jp/linux/lin_sshrsa_win.html#ah_2

VisualBox <= Scientifc Linux =>http://fakeyakuza.hatenablog.com/entry/20110914/1316013181(2011-09-14)
=>http://assimane.blog.so-net.ne.jp/2011-07-10
(install系)=>http://scientificsrv.com/scientific6.shtml


共有フォルダ
http://tobysoft.net/wiki/index.php?Ubuntu%2FVirtualBox%2F%B6%A6%CD%AD%A5%D5%A5%A9%A5%EB%A5%C0%BC%FE%A4%EA#b7b7b30d

[VisualBox-Scientific Linux]
all host = > SElinux無効化 => http://fedorasrv.com/memo/log/35.shtml
                                     => http://scientificsrv.com/scientific6-init.shtml
           = > iptables 無効化 = > http://www.server-world.info/query?os=Scientific_Linux_6&p=initial_conf&f=2

host1 = >Nginx install = >http://blog.wnotes.net/blog/article/16
    =>http://sakura.off-soft.net/centos/apache-nginx-1-nginx-install.html
hos2,3 => NodeJS = > http://scribble.washo3.com/linux/node-js%E3%82%92%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB.html
                          => http://blog.glidenote.com/blog/2012/01/24/install-hubot/
                          =>
         => MySQLServer =>http://centossrv.com/mysql.shtml
                                  => https://rewse.jp/blog/p/4370
         => Mroonga => http://mroonga.github.com/ja/docs/install.html
         => Memchach =>


mySQL-Reprication-udev


scientific linux-yum update でエラー
[Error 14]PYCURL ERROR6 みたいな。
scientific errno 14 pycurl error 6
<解決策>=>ネットワーク設定
eth1(NAT)
 "BOOTPROTO=dhcp"


make install -> No rule to make target 'install'.Stop

# ./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module
ー>not found gcc
yum install gcc
再度実行

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by usi
yum -y install pcre-devel(http://d.hatena.ne.jp/pirosikick/20101018/1287415379)
再度実行
→今度はopensslがない。
yum install openssl-devel
→今度はlibxml2/libxslt
→今度はimage filter modele GD library




sudo rpm -ivhU http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.2.2-1.el6.ngx.x86_64.rpm

[node]
http://d.hatena.ne.jp/replication/20110720/1311088237

mysql
http://tech.hitsug.net/?CentOS%2FMySQL%2FMySQL5%EF%BC%88yum%EF%BC%89%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB
→v0.6.20


Memcache
http://blog.mktime.com/archive/55.html

Mroonga
→全然ダメ
→mysql5.5だとそもそも入らない。
→mysql5.1だと入る。
http://mroonga.github.com/ja/docs/install.html
→vi /etc/yum.repos.d/groonga.repo
で、どっかを6にする。
からの、yum  makecache
からの、yum mysql-mroonga
で、確認http://mroonga.github.com/ja/docs/install.html


共有フォルダ
http://d.hatena.ne.jp/kakurasan/20070708/p1
http://mpweb.mobi/windows/share-centos.php
Guest Additionhttp://ikekobo.com/2011/09/virtualbox-%E3%81%AB-centos6-0-%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/
した準備http://mpweb.mobi/windows/guestadditions-centos.php
あとこれじゃね?http://d.hatena.ne.jp/calcul8/20101204/1291457686



ーーーーーーーーーーーーーーーーーーーーーーーーーーー
OpenSSHの公開鍵の登録とGitリポジトリの作成をお願いします。
サーバー:http://~
ユーザー名:mail
パスワード:パスワード
プロジェクト:メールアドレスの@以前

http://rat.cis.k.hosei.ac.jp/article/java/eclipseandcvs.html