<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: trace code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 01:36:24 GMT</pubDate>
    <description>DZone Snippets: trace code</description>
    <item>
      <title>JSP: Printing Java stacktraces in JSP pages</title>
      <link>http://snippets.dzone.com/posts/show/5663</link>
      <description>// This snippet shows how to view java stack traces for exceptions occurring inside jsp files.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;try{&lt;br /&gt;  //some code that throws an exception&lt;br /&gt;}&lt;br /&gt;catch(Exception e){&lt;br /&gt;  // Cannot print using standard out. Cast JSP writer into a print writer.&lt;br /&gt;  e.printStackTrace( new java.io.PrintWriter(out))&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 18 Jun 2008 17:31:56 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5663</guid>
      <author>mehlam2 (Mehlam)</author>
    </item>
    <item>
      <title>Get a String version of a stacktrace</title>
      <link>http://snippets.dzone.com/posts/show/4562</link>
      <description>// Get a String version of a stacktrace&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    Throwable t = new Throwable();  // test code&lt;br /&gt;&lt;br /&gt;    final Writer result = new StringWriter();&lt;br /&gt;    final PrintWriter printWriter = new PrintWriter(result);&lt;br /&gt;    t.printStackTrace(printWriter);&lt;br /&gt;    result.toString();&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 20 Sep 2007 21:00:14 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4562</guid>
      <author>frost137 (Douglas Wyatt)</author>
    </item>
    <item>
      <title>Ruby - Trace Variable Global</title>
      <link>http://snippets.dzone.com/posts/show/3036</link>
      <description>// Tracciare variabili Globali&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;trace_var:$variabileGlobale, proc{ print "variabileGlobale modificata al valore --&gt; ", $variabileGlobale, " "}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 25 Nov 2006 19:47:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3036</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>get the name of the calling methos</title>
      <link>http://snippets.dzone.com/posts/show/2787</link>
      <description>caller_method_name() gets you the name of the calling method.&lt;br /&gt;you could also get the line and file in which the method is called.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;def caller_method_name&lt;br /&gt;    parse_caller(caller(2).first).last&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def parse_caller(at)&lt;br /&gt;    if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at&lt;br /&gt;        file = Regexp.last_match[1]&lt;br /&gt;		line = Regexp.last_match[2].to_i&lt;br /&gt;		method = Regexp.last_match[3]&lt;br /&gt;		[file, line, method]&lt;br /&gt;	end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 05 Oct 2006 21:21:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2787</guid>
      <author>derbumi (Michael)</author>
    </item>
  </channel>
</rss>
