();
@Property
private User currentUser;
}
Users management tools with CRUD!
@Inject
private Logger logger;
log4j.rootCategory=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n
log4j.category.org.apache.tapestry5.TapestryFilter=info
log4j.category.org.apache.tapestry5=error
log4j.category.tapestry5=error
#### Second appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/testsecurity.txt
# Control the maximum log file size
log4j.appender.R.MaxFileSize=10MB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
#log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.R.layout.ConversionPattern=%p [%t] %d{dd MMM yyyy HH:mm:ss} (%F:%L) - %m%n
-----------------------------------------------------------------------------------------------------------------
Ruby и многозадачность
Иван Шихалев
puts 'begin'
th = Thread.new do
(1..3).each { |i| puts i }
end
# sleep 0
puts '---'
th.join
puts 'end'
th = Thread.new do
puts 'started'
Thread.stop
puts 'continued'
sleep 100
puts 'finished'
end
sleep 0.1
puts 'wakeup'
th.wakeup
sleep 0
puts 'terminate'
th.terminate
th.join
Thread.new 1, 2, 3 { |a, b, c| ... }
flag = true
5.times do
Thread.new do
puts 'true' if flag
flag = false
end
end
Thread.list.each do |th|
if th != Thread.current
th.join
end
end
5.times do
Thread.new do
Thread.exclusive do
puts 'true' if flag
flag = false
end
end
end
alpha = true
alpha_m = Mutex.new
beta = true
beta_m = Mutex.new
5.times do
Thread.new do
alpha_m.synchronize do
puts 'alpha' if alpha
alpha = false
end
beta_m.synchronize do
puts 'beta' if beta
beta = false
end
end
end
th = Thread.new do
sleep 0.1
p Thread.current.thread_variable_get 'alpha'
end
th.thread_variable_set 'alpha', :alpha
th.join
th = Thread.new do
sleep 0.1
p Thread.current['alpha']
end
th['alpha'] = :alpha
th.join
f = Fiber.new do
current = Time.new
loop do
last = current
current = Time.new
Fiber.yield [last, current]
end
end
5.times do
p f.resume
sleep 1
end
pid = fork do
3.times do |i|
sleep 0.01
puts "Child [#{Process.pid}]: #{i}"
end
end
3.times do |i|
sleep 0.01
puts "Parent [#{Process.pid}]: #{i}"
end
Process.waitpid pid
spawn(‹env,› command ‹, args›*, ‹options›) → pid
child = fork do
count = 0
Signal.trap :USR1 do
count += 1
puts "Signal USR1: #{count}"
end
Signal.trap :TERM do
puts 'Signal TERM'
exit
end
sleep 1000
puts 'Ooops!'
end
Signal.trap :CHLD do
puts 'Child died.'
end
Process.kill :USR1, child
sleep 0.01
Process.kill :USR1, child
Process.kill :TERM, child
Process.wait
rd, wr = IO.pipe
child = fork do
rd.close
wr.write 'From Child'
wr.close
end
wr.close
msg = rd.read
rd.close
p msg
Process.wait
rd, wr = IO.pipe
child = spawn "echo 'External Child'",
[ STDERR, STDOUT ] => wr
wr.close
msg = rd.read
rd.close
p msg
Process.wait
-----------------------------------------------------------------------------------------------------------------
Качество программного кода. От выявления стилистических огрехов к поиску ошибок
Денис Силаков
void CAST256::Base::UncheckedSetKey()
{
word32 kappa[8];
...
memset(kappa, 0, sizeof(kappa));
}
$ valgrind kopete
-----------------------------------------------------------------------------------------------------------------