SELECT sikepuri_downlog.sikepuri_id AS sikepuri_id, COUNT(*) AS down_count, sikepuri.title AS sikepuri_title, sikepuri.creater AS sikepuri_creater FROM sikepuri_downlog, sikepuri WHERE 1310266968 <= sikepuri_downlog.time AND sikepuri_downlog.time <= 1310276968 AND sikepuri_downlog.sikepuri_id = sikepuri.id GROUP BY sikepuri_downlog.sikepuri_id ORDER BY down_count DESC
SELECT sikepuri_downlog.sikepuri_id AS sikepuri_id, COUNT(*) AS down_count, sikepuri.title AS sikepuri_title, sikepuri.creater AS sikepuri_creater, classdata.name1, COUNT(DISTINCT classdata.id) AS classdata_count FROM sikepuri_downlog, sikepuri LEFT JOIN sikepuri_link ON sikepuri.id = sikepuri_link.sikepuri_id LEFT JOIN classdata ON sikepuri_link.classdata_id = classdata.id WHERE 1310266968 <= sikepuri_downlog.time AND sikepuri_downlog.time <= 1310276968 AND sikepuri_downlog.sikepuri_id = sikepuri.id GROUP BY sikepuri_downlog.sikepuri_id ORDER BY down_count DESC, sikepuri_id ASC
6.3 Timers — HTML5 http://www.w3.org/TR/html5/timers.html#dom-windowtimers-settimeout
---
If the currently running task is a task that was created by the setTimeout() method, and timeout is less than 4, then increase timeout to 4.
-----
4ms以下の場合は4msになるらしい。これはいい情報だ。
SMTPの仕様に従っていない、SMTPもどきサーバー。 by Ruby
-----
require 'socket'
require 'kconv'
def log(*str)
str.each{|s|
print s.to_s.tosjis
}
end
class String
def startwith(str)
self.slice(0, str.length) === str
end
end
gs = TCPServer.open(25)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(':'))
while true
Thread.start(gs.accept) do |s|
log s, " is accepted.\n"
s.write "220 OK\r\n"
line = s.gets
if line.startwith('EHLO')
s.write "502 ERR\r\n"
line = s.gets
end
if !line.startwith('HELO')
s.write "500 ERR\r\n"
s.close
return
end
s.write "250 OK\r\n"
while !(line = s.gets).startwith('DATA')
s.write "250 OK\r\n"
log line
end
s.write "354 ENTER\r\n"
log line
while !((line = s.gets) === ".\r\n")
log line
end
s.write "250 OK\r\n"
if !(line = s.gets).startwith('QUIT')
s.write "500 ERR\r\n"
s.close
return
end
s.write "221 CLOSE\r\n"
def log(*str)
str.each{|s|
print s.to_s.tosjis
}
end
class String
def startwith(str)
self.slice(0, str.length) === str
end
end
gs = TCPServer.open(25)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(':'))
while true
Thread.start(gs.accept) do |s|
log s, " is accepted.\n"
s.write "220 OK\r\n"
line = s.gets
if line.startwith('EHLO')
s.write "502 ERR\r\n"
line = s.gets
end
if !line.startwith('HELO')
s.write "500 ERR\r\n"
s.close
return
end
s.write "250 OK\r\n"
while !(line = s.gets).startwith('DATA')
s.write "250 OK\r\n"
log line
end
s.write "354 ENTER\r\n"
log line
body = []
while !((line = s.gets) === ".\r\n")
log line
body.push line
end
s.write "250 OK\r\n"
if !(line = s.gets).startwith('QUIT')
s.write "500 ERR\r\n"
s.close
return
end
s.write "221 CLOSE\r\n"
log s, " is done.\n"
s.close
if body.length != 0
key = nil
bodystr = ''
body.each do |line|
if line.startwith 'To:'
key = line[/\d{10,}/]
break
end
end
lambda do
state = 0
body.each do |line|
if state == 0 && line == "\r\n"
state = 1
elsif state == 1
bodystr << line.chomp << "\n"
end
end
end.call
Net::HTTP.post_form(
URI.parse('http://jbbs.livedoor.jp/bbs/write.cgi/computer/38153/1307542890/'),
{
'DIR' => 'computer',
'BBS' => '38153',
'KEY' => key,
'TIME' => Time.now.to_i.to_s,
'NAME' => '',
'MAIL' => '',
'MESSAGE' => bodystr.toeuc
}
) if key != nil && !bodystr.empty?
end
end
end