This is how I debug SystemStackError when there is no stack trace.
My first attempt was:
begin
a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
puts caller
end
orange:~ $ ruby signal_handling.rb | |
pid 81402 is sleeping... | |
^CRuby ensure was run! | |
Ruby at_exit was run! | |
signal_handling.rb:34:in `sleep': Interrupt | |
from signal_handling.rb:34 | |
orange:~ $ jruby signal_handling.rb | |
pid 81431 is sleeping... | |
^CJava shutdown hook was run! |
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The | |
# XML Reader is a good way to move a cursor through a (large) XML document fast, | |
# but is not as cumbersome as writing a full SAX document handler. Read about | |
# it here: http://nokogiri.org/Nokogiri/XML/Reader.html | |
# | |
# Just pass the reader in this parser and specificy the nodes that you are interested | |
# in in a block. You can just parse every node or only look inside certain nodes. | |
# | |
# A small example: | |
# |
upstream tunnel { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name dev.codeplane.com br.dev.codeplane.com; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; |
require 'java' | |
# setup executor | |
java_import 'java.util.concurrent.ThreadPoolExecutor' | |
java_import 'java.util.concurrent.TimeUnit' | |
java_import 'java.util.concurrent.LinkedBlockingQueue' | |
java_import 'java.util.concurrent.FutureTask' | |
java_import 'java.util.concurrent.Callable' | |
core_pool_size = 5 |
/* Exercise: Loops and Functions #43 */ | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) float64 { | |
z := float64(2.) |
#' Creates a dialog box using tcl/tk to get input from the user. | |
#' | |
#' This function will create a tcl/tk dialog box to get user input. It has been | |
#' written to be extensible so the R programmer can easily create a dialog with | |
#' any number of varaibles with custom labels and data conversion of the user | |
#' entered data. The function will return a list where the element names are | |
#' \code{vars} and the value is the user input. By default, all entry will be | |
#' converted using the \code{as.character} function. However, this can easily be | |
#' altered using the \code{fun} parameter. For example, if integers are required, | |
#' use \code{fun=c(as.integer, ...)}. It is also possible to write custom |
This is how I debug SystemStackError when there is no stack trace.
My first attempt was:
begin
a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
puts caller
end
Введение
Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.
http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html
Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.
Ruby
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Test that I passed on codility.com for TopTal company | |
# | |
# Task #1 | |
def binary_gap(N): |