いまよブログ
2012年5月17日木曜日
html cssサイト作成メモ
memo
親要素の
height:auto;
は重要
margin 0 auto;
中央寄せ
@charset "utf-8";
/*コンテンツ部分*/
*{
padding: 0;
margin: 0;
}
header, footer, section, aside, nav, article {
display: block;
}
body{
background-image:url(../images/white.jpg);
background-repeat:repeat;
}
#container {
height: auto;
width: 880px;
margin:0 auto;
}
header{
width:880px;
height:auto;
background-image:url(../images/white.jpg);
background-repeat:repeat;
}
#main{
margin-left:10px;
width: 590px;
height:auto;
float: left;
}
aside#sub {
margin:10px;
width: 260px;
height: auto;
float:right;
}
footer{
float: left;
width:880px;
height:auto;
background-image: url(../images/back_footer.gif);
background-repeat: repeat-x;
height:109px;
}
<div id="container">
<header>
<div id="logo">
<a href=""><img src="" alt=""></a>
</div>
<nav>
</nav>
</header>
<section id="main">
<article id="1">
hogehoge
</article>
<article id="2">
hogehoge
</article>
</section>
<aside id="sub">
<article id="3">
</article>
</aside>
</div>
2012年1月31日火曜日
[rails3] rake 時のエラー
環境
mac:OSX 10.7.2(Lion)
rails3.1
gem –version 1.3.7
rake –version 0.9.2.2
mac:OSX 10.7.2(Lion)
rails3.1
gem –version 1.3.7
rake –version 0.9.2.2
//////////////////////
rakeを入れてるにもかかわらず、
$rake db:migrateすると
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:779:in `report_activate_error’: Could not find RubyGem rake (>= 0) (Gem::LoadError)
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:214:in `activate’
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:1082:in `gem’
from /usr/bin/rake:18
そうかい、おまいさん。rakeないんだね。
本当なのかい。
$ which rake
/opt/local/bin/rake
あるやないけ!!あるけどしゃーないいれたるわ。
$sudo gem install rakeしたら
Successfully installed rake-0.9.2.2
1 gem installed
Installing ri documentation for rake-0.9.2.2…
Installing RDoc documentation for rake-0.9.2.2…
んでいけるかな。
$ rake db:migrate
rake aborted!
no such file to load — bundler/setup
違うエラーが。。
ぐぐると
$rake db:migrateすると
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:779:in `report_activate_error’: Could not find RubyGem rake (>= 0) (Gem::LoadError)
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:214:in `activate’
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:1082:in `gem’
from /usr/bin/rake:18
そうかい、おまいさん。rakeないんだね。
本当なのかい。
$ which rake
/opt/local/bin/rake
あるやないけ!!あるけどしゃーないいれたるわ。
$sudo gem install rakeしたら
Successfully installed rake-0.9.2.2
1 gem installed
Installing ri documentation for rake-0.9.2.2…
Installing RDoc documentation for rake-0.9.2.2…
んでいけるかな。
$ rake db:migrate
rake aborted!
no such file to load — bundler/setup
違うエラーが。。
ぐぐると
http://stackoverflow.com/questions/7483515/rake-aborted-no-such-file-to-load-bundler-setup-rails-3-1
でた。これ
対処方法
$sudo gem install bundler
$ sudo bundle install
これまちがいなし。
なおった!
対処方法
$sudo gem install bundler
$ sudo bundle install
これまちがいなし。
なおった!
perl template::toolkitを使ってみた。
仮定条件
name.txtとしてファイルで提出する必要がある。
そこで、末尾のm1_member.csvを利用して、
人数分のname.txtを生成するプログラムを作成しなさい。
・申し込みフォーマット(template.txt)
—————————————-
○×研究会 申し込み
氏名 :
フリガナ:
所属 :
e-mail :
—————————————-
・yottan.txtの作成例
—————————————-
○×研究会 申し込み
氏名 :その名はよったん
フリガナ:ソノナハヨッタン
所属 :よったん大学
e-mail :yottan@yottan.com
—————————————-
・m1_member.csv(氏名,フリガナ,e-mail,name)
“その名はよったん,ソノナハヨッタン,yottan@is.naist.jp,yottan”
windows7
m1_member.csvはutf8で書かれています。
使ったファイルは全部同じディレクトリに入ってます。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| #!usr/bin/perl use strict; use warnings; use Template; use Encode; use open IN => ":utf8" ; my $file = "m1_member2.csv" ; # 読み込みたいファイル名 open ( my $fh , "<" , $file ) or die "Cannot open $file: $!" ; while ( my $line = readline $fh ){ # readline関数で、一行読み込む。 my @s = split ( /,/, $line ); my $name = $s [0]; my $kana = $s [1]; my $shozoku = "よったん大学" ; $shozoku =decode( 'utf8' , $shozoku ); my $mail = $s [2]; my $romaji = $s [3]; chomp $romaji ; # chomp関数で、csv形式の改行を取り除く #作成するファイルネーム***.txtの作成 my $filename = $romaji . ".txt" ; open (OUTPUTFILE, ">>$filename" ); my $vars = { name => $name , kana => $kana , shozoku => $shozoku , mail => $mail , }; #テンプレート'template.txtの格納場所・文字コードの指定など' my $config = { UNICODE => 1, #これでテンプレファイルが ENCODING => 'utf-8' , #utf-8フラグ付きとなる。 # テンプレート(template.txt)の置いている場所 INCLUDE_PATH => 'C:\Perl\program' , }; my $tt = Template->new( $config )|| die $Template ::ERROR, "\n" ; $tt ->process( 'template.txt' , $vars , $filename ) || die $tt ->error(), "\n" ; close ( OUTPUTFILE ); } |
実行結果
○×研究会
氏名:その名はよったん
フリガナ:ソノナハヨッタン
所属:よったん大学
メール:yottan@yottan.com
参考ページ
参考ページ
template:toolkit全般について↓
のsynopsysのところ
文字コードの扱い↓
登録:
投稿 (Atom)