Ȥ Blog

Ruby,C#

2011ǯ07

ϥǥܹԣϥǥʤʤä

˼긵iMacOSLion˥åץǡȤ顢ϥǥ塼ʡM2TVʤʤޤ
ɥ饤ФбƤʤȤȤ
Ȥꤢ饱Υ󥻥뤫鸫褦ȻפиǤɡ

ˤƤ⡢־ͻΤǾͼξʴˤƷ귡ääơˤ狼ˤϿ񤤡
˰̣狼ʤơ֤ááפȻפäΤϻǤϤʤȻפ

ŷ by

ᥬΥǥ˥󥰡֥åġפλդ˼ڤꤿܡ
Ƥϲ˽񤤤Ƥ̤ǡ츫ʤ򤽤äǤϤʤΤǤ줬ɤ߻ϤȻߤޤޤ󡣵פ֤ꡢޤʸݽΤ1,2֤ǤϤΤǤȤˤ򤫤ä
ɽϤʤ
ؤˤĤ¤ؤοͤϺȤμ­ǧ㤤ˤʤäƤޤޤڤʤ褦Ǥ

줫ʤǤѥη辡ʧä̲꤬ä4Ⱦ˵ƤޤޤäȸƤߤ뤫ɤäƤϤʤɡŪʥΥٸȾﳫϤ鸫ƤޤäΤǤɤΤ򸫤ޤݡĤTVǤʤ̴ǸȤϤĤƤʤ⤷ʤˤޤ޵ɤäǤ
 

ȥŷ
//Artist
, 1,890 Ź(롼ץѥ֥å)
ɾ
2011-07-19

ƾҲ

͡徭ȹˤθ塣֥ץȡפΩä¨ȼ夲뤳--ʸѤ礤ʤײ򡢸ĤĹʪȤƤߤߤŸ微!!

ơʡBOOKץǡ١ˡ

ͻ塢̤ʹΥ٥㡼ȤҤˤߥåϡȼפ뤳ȡǤˤƿؼԡճǯˤ錄ʳƮޡӡ!᤯ɽʨƭ!ӱѤˤƵͤ뿷Ĭή˥ޥ


LinuxASP.NET MVC3(ӥ塼󥸥Razor)ư

褦䤯ŻǤRails3ˤʤäΤǡФ餯ϥץ饤١ȤǤC#ǿꤿ
Ȥ櫓ǡASP.NET MVC3DZӥ塼󥸥RazorѤƺäWebץLinuxmono
ưƤߤޤ

MonoDevelop(ޥå)MVC3RazorˤϤޤбƤʤΤǡȯVisualStudio2010ǺơLinuxCent5.5)Mono˥ǥץ뤳Ȥˡ

ȯWindows7, VS2010, MVC3, Razor
ۥ: Linux(Cent5.5), Apache

ȤꤢưǧΤᡢǥեȤMVCץȤ򥳥ѥ뤷Linux˥ԡ
monoASP.NETưˤϡ
http://www.mono-project.com/ASP.NET
˽񤤤Ƥ뤳Ȥˤȡ
mod_mono
xsp
ɬפȤΤȡ
줾쥽Ȥƥѥ󥹥ȡ롣
󥹥ȡ뤬λȡmod_mono.conf ȤApacheե뤬ƤΤǴŪˤϤΤޤޤOK
ξ /etc/httpd/ ľˤǤƤΤǡconf.d˰ư

³ƥȤɤǤȡAutoHostingʤΤ餷
http://www.mono-project.com/AutoHosting
ˤAutoHostingʤ塹ASP.NETץȤۥȤǤ⤤ApacheեϮɬפʤǤ衼ȤΤȡؼ̤ե򤤤äƤ顢MVCץȤξϥ롼ƥ󥰤˥եĥҤѤʤ鱾ȤǡAutoHostingϿ侩ޤ󡢤äơʤꥬåꡣ
ǡʤΤǡ̤ˡASP.NETΥץñ̤Apacheե뤳Ȥˡ

http://go-mono.com/config-mod-mono/
ΥȤǤɬפʹܤϤФ򸵤եƤ褦ʤΤǡС̾ȤץȤΥǥ쥯ȥѥȤɬפʹܤϤƺäƤ餦
mod-mono-serverΥѥ/usr/binˤʤäƤ㴳ʬδĶȰۤʤäƤΤǡϼʬǽmod-mono-server2ȤʤäƤΤmod-mono-server4ѹ
Ĥ򥳥ԡơApacheconf.d my_mvc_project.conf ߤ̾ΥեäƤ¸

ApacheƵưƥ֥饦ɽƤߤȡʤ󤫥顼
⡼ȥޥʤΤǥ顼Ƥ狼ʤᡢWeb.config <customErrors mode="Off" />ˤƺ٥ȥ饤
ʤDLLĤʤ衼ߤʤȤΤǡVS2010äɬפDLL򻲾ɲäơˤĤΥץѥƥǥ륳ԡTrueˤƺƥǥץ
Ȥޤ̤DLLʤ衼ȸΤǡƱͤκȤ򷫤֤
WindowsäƤʤʤʤDLL
  • System.Web.Mvc.dll 
  • System.Web.Razor.dll 
  • System.Web.WebPages.dll 
  • System.Web.WebPages.Deployment.dll 
  • System.Web.WebPages.Razor.dll
  • System.Data.Entity
  • System.Web.Helpers.dll
 EntityȤȤäƤʤɤʡ

ǤȤꤢڡɽޤ

C#RedisƤߤ

MemcachedRubyͽäɡȾʬޤRedisC#Ƥߤ뤳Ȥˤޤ ŻǤϤɤäRailsǤͽʤǡȤǿʤC#ǤäƤȤǡ

ȤꤢRedis򥤥󥹥ȡ롣

wget http://redis.googlecode.com/files/redis-2.2.11.tar.gz
tar xzvf redis-2.2.11.tar.gz
cd redis-2.2.11
make
sudo make install

ߤhttp://redis.googlecode.com/
ΥȤǤϥ֥饦ǥ󥿥饯ƥ֤RedisΥޥɤáTutorialä򤫤äǤ

RedisСưƤߤ롣
redis-server
饤ȤưƤĤŬʥޥɤáưǧ
redis-cli #饤ȵư

#rootȤ̾ satoyan ʸ򥻥å
redis 127.0.0.1:6379> set root satoyan
OK

#Ф
redis 127.0.0.1:6379> get root
"satoyan"

#queen:membersꥹȤκǸ Fready ɲ
redis 127.0.0.1:6379> rpush queen:members Fready
(integer) 1

#ƱͤBrian ɲ
redis 127.0.0.1:6379> rpush queen:members Brian
(integer) 2

#ꥹȤȤɽ 0-1ȤΤϤĤޤƬǸޤǤȤ
redis 127.0.0.1:6379> lrange queen:members 0 -1
1) "Fready"
2) "Brian"

C#Redis򰷤饤֥ɤ롣ʤ󤫴Ĥ褦ǤServiceStack.RedisȤΤǻƤߤ롣

https://github.com/ServiceStack/ServiceStack.Redis
DLL켰ɡ

MonoDevelopưŬʥץȤDLLȤɲá
ʴ

Ruby1.9.2 Rails2.3 MySQLencodingȥ֥

Ruby1.9.2ʸ󤬥󥳡ɾĤ褦ˤʤä褦ʤΤǤRailsǤ褯ѤMySQLɥ饤С̤бΤᤫActiveRecordǼǡʸϤ٤ASCII8ȤưƤޤ褦Ǥ

ĤΤViewǥ顼¿ȯƤޤƺä Ĵ٤Ƥߤ gem mysql2 Υ󥳡ˤбƤ餷

®󥹥ȡ뤷Ƥߤ롣

https://github.com/brianmario/mysql2

嵭ȤActiveRecordιܤɤǤߤȡRails3.1̤ξϥС0.2ϤȤȤΤȤʤΤǡenvironment.rb

config.gem "mysql2", :version => "0.2.11"
Ȥơ
rake gems:install
database.yml
development:
  adapter: mysql2
  database: hoge
  encoding: utf8
Ȥ̵˥ޥХʸⰷ褦ˤʤޤ ˤƤRuby1.8ϤΥ1.9˹碌뤿ˤϡ̤ΥեƬ˥󥳡ɤ򼨤ޥåȤɵʤʤʤ¾ˡʤΤʡ

Ǥ MemcachedȤäƤߤ

äȶ̳ϤФäΤǡǤ MemcachedȤäƤߤ뤳Ȥˡ

Ȥꤢhttp://memcached.org/饽Ȥƥ󥹥ȡ롣

wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
tar xzvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure 
./configure
onfigure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/
ȥ顼ˤʤΤǡؼ̤ http://www.monkey.org/~provos/libevent/libeventʤΤΥȤƥ󥹥ȡ뤷Ƥߤ롣
wget http://www.monkey.org/~provos/libevent-2.0.12-stable.tar.gz
tar xzvf libevent-2.0.12-stable.tar.gz 
cd libevent-2.0.12-stable
./configure
make
sudo make install

̵˥󥹥ȡ뤵줿褦ʤΤǵľmemcacheΥ󥹥ȡ˥ȥ饤

./configure
make
sudo make install

󥹥ȡ̵˺Ѥ褦ʤΤ
memcached
Ǽ¹Ԥ褦ȤȤޤ顼

memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

ºݤˤ/usr/local/lib/˥ե¸ߤΤɡĤƤʤΥڡ򻲹ͤѹ

memcached -vv
ǵư telnet³
telnet localhost 11211

ʤŬ˥ǡϿƤߤ.

set myname 0 0 7  #ǽ0ϰ̤뤫ʤ / ͭ֡ʣ̵¡ / ϿǡХȿ
satoyan
STORED
get myname
VALUE myname 0 7
satoyan
END
Ȥꤢưޤ

ϤRuby鰷äƤߤ뤳Ȥˤ褦

Rails3ActiveScaffold

ActiveScaffoldϤĤˤʤäRails3бΤʡ ʤƤäȻפäƤ顢ȤäFork줿ץȤäơ餬Rails3бƤޤ

https://github.com/vhochstein/active_scaffold

ưǧΤñʥץäƤߤ롣

#railsץȤ
rails new active_scaffold_test
cd  active_scaffold_test
bundle install

#ActiveScaffoldץ饰򥤥󥹥ȡ
  rails plugin install git://github.com/vhochstein/active_scaffold.git -r 'rails-3.0'

#gemǥ󥹥ȡ뤷
gem "active_scaffold_vho" 

#ActiveScaffoldΥåȥå 
rails g active_scaffold_setup jquery  #ɸPrototypeȤϺǸjqueryλ̵

#ХɤȥХɥС褦ʤΤäƤߤ
rails g active_scaffolf BandGroup name:string
rails g active_scaffolf BandMember name:string instrument:name band_group:references
rake db:migrate

#С¹
rails s

ʴǤǤޤ

奵С ٻΤͯ 󥿥뤷Ƥߤޤ

̺Ҥο­äơѡˤ̤Υڥåȥܥȥο夬¤֤褦ˤʤޤ㤤äƱ֤Τ빽ݤäꤷޤʤ͡
ʰ餷ˤξϡ¢ˤǤ䤷ꤹΤݤäꤷޤ
Ȥ櫓ǡ奵СäƤߤ뤫ȤӤˤʤޤ

餬ͭ̾餷ΤǤϿ͹ȤΤȤǵѲ 
äѤ߿ŷΤۤɤ˷ޤäƤޤʤΤǡٻΤͯΤƤߤޤ

  • СΥ󥿥뤬800/
  • 1ѥå(12åȥ)1600(133/1åȥ)
  • ʸХޥȤۤ23
  • (̤䤿̣)ʤȤǮξȤ롣

ѡʤɤdzʰ¤䤷ƤڥåȥܥȥοӤȤäȳⴶݤޤ󤬡̣Ȱȹμ֤ʤȤ̤θСޤޤäƤʴǷǤޤ

º1֤ۤɻȤäƤߤޤͽ۰ʾ˲Ŭ
Ϥ俲ʤɡä˽뤤λˡä䤿ʤ줬䤿ˡ̣夬ȤȤʤɤΤȽƼ´ޤ

ˤΤۤ⤽Τޤޥåͤ˻ȤǮ ʱĶôԡˤΤǡ䥳ҡˤȤޤåͼΤϸĿŪ¿˿ʤΤǤ䥫åפ̣ǻȤäȤޤʤΤ´

弫ΤϡΥХʥ˭٤˴ޤǤ롢ȤΤȤǤХʥबʤΤΤޤ󤬡¿ʬɤΤʤǤ礦äȡ



ոϾͻԺ߽ʤΤǡ᤯FujioxȤҡʥҤϲοäƤȤ¿ΤŹͳǿߤޤ֤鲿ޤDZĶôԤľܿäƤ줿ꡢ⤷Ƥ줿Τǡʤ¿Ǥ

ϴϢȤΤޤ路ԤǤϤޤǰΤᡣ

Ų ¤ Ϻʤɤ

ˡػ夫ͧͤη뺧˾Ԥ졢դ֣ͤۤɤŲޤǹԤäƤޤޤ
ƸϤȤƤľӤäꡣ
̣ơĤʿ餲ޤ
ǡϵŲؤΤˤ¤򲰡ֲϺפǡֳҤĤޤ֤סֱΤҤĤޤ֤סŲǤפΤǤ줬ɤ⤹٤ꡪ

  • ҤĤޤ֤
    ˤɥ󡢤ȤΤäƤޤΤޤޤǤ⤪ҤǤ⤫ʤ̣
  • ΤҤĤޤ֤
    оƤʤΤħ硼̣⤽ΤޤޤǤ⤪ҤǤOKҤ˴ؤƤϽнƤƽФǤ̣ä

  • դ碌ǽФƤ᤬ʤ̣äΤ̤ñʤʸ뤳Ȥˡ
    ꡢGood
  • ŲǤ
    ˤ㤯ˤޤ̣߹Ǥ롣ŲǤϵڤ򿩤٤ʤŲǤǤϤʤȽ˸줿ΤǤĿŪˤϤˤ㤯ɤäڤ褫äɡ
 Źʷϵ⡢ӥήǤ
¤ŹǤϤʤǤŲ˹ԤäݤˤϤҴäƤߤߤŹǤ
ץե

Ȥ

C#ɻŻRubyФʳȯԡ
ǶDockerȤؿȤAngularJS˥ϥޤäƤ롣
¢ȤĮȤȤ˽ס

QR
QR
  • 饤֥ɥ֥