diff --git a/root/editor.css b/root/editor.css index 7651e4d..e5dfc67 100644 --- a/root/editor.css +++ b/root/editor.css @@ -7,6 +7,7 @@ h1{border-bottom: double 5px #72ff83;} textarea {height:300px; width:500px; margin-bottom: 20px;} +textarea.tea {height:100px; width:400px; margin-bottom: 20px;} div#result{ background-color: black; diff --git a/root/editor.rb b/root/editor.rb index 3fde2ce..50294c4 100755 --- a/root/editor.rb +++ b/root/editor.rb @@ -7,19 +7,20 @@ require'open3' require'timeout' -#ENV['RUBYOPT']="-Ku" + +begin + Timeout.timeout(0.5){ c = CGI.new(:accept_charset => "UTF-8") -p = " -i = 1 -while i <= 1000 -if i%2 == 0 -puts i -end -i += 1 -end -".toutf8 +# question = c["que"] +# pro = c["program"].toutf8 +# mes = c["mes"] +# hint = c["hint"] + +p = "puts\"aa\"" +que = "問題文" +mes = "メッセージ" cmd = "ruby -Ku -e '#{p}'" o,e,s = Open3.capture3(cmd) @@ -42,18 +43,30 @@

名前を入力してください

-

1〜1000までの数のうち、偶数のみ表示させるプログラムを作成してください。

+ +EOF + +printf("

%s

\n", que) + +print <プログラムのコードを入力

出力例

-

※print文などで一文づつ書いている場合は減点しまーーーーす

- EOF + printf("\n", o.toutf8) +printf("

どこでつかうの??

%s

\n", mes) puts("") puts("\n") + + } +rescue Timeout::Error + file = File.open("errormes.txt", "r") + puts file.read + file.close +end diff --git a/root/teacher.rb b/root/teacher.rb new file mode 100755 index 0000000..64c7a89 --- /dev/null +++ b/root/teacher.rb @@ -0,0 +1,45 @@ +#!/usr/bin/env ruby +# coding: utf-8 + +Encoding.default_external = 'utf-8' +require'cgi' +require'sqlite3' + +c = CGI.new(:accept_charset => "UTF-8") + +print("Content-type: text/html; charset=utf-8\n\n") + +print < + + + + 教員用ページ + + + + + +
+ +

問題文を記入

+ + +

プログラム文を記入

+ + +

メソッド・どういったタイミングで使うかを記入

+ + +

ヒントを入力

+ + +EOF + +puts(" +") +puts("
") + +puts("\n") diff --git a/root/textcode.rb b/root/textcode.rb index 3ea66ca..fe872f7 100755 --- a/root/textcode.rb +++ b/root/textcode.rb @@ -13,7 +13,7 @@ end begin - Timeout.timeout(2){ + Timeout.timeout(0.5){ c = CGI.new(:accept_charset => "UTF-8")