<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>C-ba.org</title>
	
	<link>http://en.c-ba.org</link>
	<description>Java and php expert</description>
	<lastBuildDate>Tue, 21 Apr 2009 20:38:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/EnglishCba" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>USB Key in my mouse</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/ez9-1i5GzJc/</link>
		<comments>http://en.c-ba.org/2009/04/21/usb-key-in-my-mouse/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 20:38:42 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[something to tell]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[old]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[workers]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=151</guid>
		<description><![CDATA[Explain how to hide your usb key into your old mouse]]></description>
			<content:encoded><![CDATA[<p>So ! You want to hide your USB key when you are working from people working with you. It is easy. Just grab a mouse which don&#8217;t work. Open It and get out evrything you found inside.</p>
<p><a href="http://www.c-ba.org/wp-content/uploads/2009/04/img_-077.jpg"><img class="aligncenter size-full wp-image-598" title="img_-077" src="http://www.c-ba.org/wp-content/uploads/2009/04/img_-077.jpg" alt="img_-077" width="352" height="234" /></a></p>
<p>The plastic screw of my son is not necessary <img src='http://en.c-ba.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . When just take an USB extension and glue it into the old mouse.</p>
<p><a href="http://www.c-ba.org/wp-content/uploads/2009/04/img_-078.jpg"><img class="aligncenter size-full wp-image-599" title="img_-078" src="http://www.c-ba.org/wp-content/uploads/2009/04/img_-078.jpg" alt="img_-078" width="187" height="124" /></a></p>
<p>Put your USB key and rebuild your mouse you will get that :</p>
<p><a href="http://www.c-ba.org/wp-content/uploads/2009/04/sans-titre.jpg"><img class="aligncenter size-full wp-image-600" title="sans-titre" src="http://www.c-ba.org/wp-content/uploads/2009/04/sans-titre.jpg" alt="sans-titre" width="269" height="178" /></a></p>
<p>Ok it is big but nobody will remark you got two mouses.</p>
<p>And never forget what Malberon said:</p>
<blockquote><p><strong>&lt;Malberon&gt; With all that I read on alcohol and drugs, I decided to stop reading. (source <a href="http://www.bashfr.org/?9626">bashfr.org</a>)<br />
</strong></p></blockquote>

<p><a href="http://feedads.g.doubleclick.net/~a/O3HAEH4V2JOXDhORAoCR3IP5lWA/0/da"><img src="http://feedads.g.doubleclick.net/~a/O3HAEH4V2JOXDhORAoCR3IP5lWA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/O3HAEH4V2JOXDhORAoCR3IP5lWA/1/da"><img src="http://feedads.g.doubleclick.net/~a/O3HAEH4V2JOXDhORAoCR3IP5lWA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/ez9-1i5GzJc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/04/21/usb-key-in-my-mouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/04/21/usb-key-in-my-mouse/</feedburner:origLink></item>
		<item>
		<title>The three SQL Oracle which will rescue you</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/EE6bi8GQrEM/</link>
		<comments>http://en.c-ba.org/2009/04/11/the-three-sql-oracle-which-will-rescue-you/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 21:22:01 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[developping]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tablespace]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=146</guid>
		<description><![CDATA[Three Oracle SQL request which could help you one day !]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><strong><a href="http://www.c-ba.org/wp-content/uploads/2009/04/logo1.jpg"><img class="size-full wp-image-578 alignleft" title="logo1" src="http://www.c-ba.org/wp-content/uploads/2009/04/logo1.jpg" alt="logo1" width="174" height="146" /></a></strong>17h45 friday, you are waiting for your weekend when the phone rings into your office.  After a short hesitation, you pick and you hear :</p>
<p><em>Hello, there is a problem in production. It seems that we got some Oracle&#8217;s lock</em></p>
<hr />Nevermind, I am here and here three SQL request which could help you one day :</p>
<p style="text-align: center;"><strong>Know the place taken by table :</strong></p>

<div class="wp_codebox"><table width="100%" ><tr id="p1461"><td class="code" id="p146code1"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> tablespace_name<span style="color: #66cc66;">,</span> sum<span style="color: #66cc66;">&#40;</span>total<span style="color: #66cc66;">&#41;</span> total<span style="color: #66cc66;">,</span> sum<span style="color: #66cc66;">&#40;</span>libre<span style="color: #66cc66;">&#41;</span> libre<span style="color: #66cc66;">,</span> sum<span style="color: #66cc66;">&#40;</span>occupe<span style="color: #66cc66;">&#41;</span> occupe<span style="color: #66cc66;">,</span> round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>total<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> sum<span style="color: #66cc66;">&#40;</span>libre<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> sum<span style="color: #66cc66;">&#40;</span>total<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>100<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">||</span> <span style="color: #ff0000;">'%'</span> taux_occupation <span style="color: #993333; font-weight: bold;">from</span> <span style="color: #66cc66;">&#40;</span>
     <span style="color: #993333; font-weight: bold;">select</span> tablespace_name<span style="color: #66cc66;">,</span> file_id<span style="color: #66cc66;">,</span> file_name<span style="color: #66cc66;">,</span> total<span style="color: #66cc66;">,</span> libre<span style="color: #66cc66;">,</span> total <span style="color: #66cc66;">-</span> libre occupe<span style="color: #66cc66;">,</span> round<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>total <span style="color: #66cc66;">-</span> libre<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> total<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>100<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">||</span> <span style="color: #ff0000;">'%'</span> taux_occupation <span style="color: #993333; font-weight: bold;">from</span> <span style="color: #66cc66;">&#40;</span>
	          <span style="color: #993333; font-weight: bold;">select</span> df<span style="color: #66cc66;">.</span>tablespace_name<span style="color: #66cc66;">,</span> df<span style="color: #66cc66;">.</span>file_id<span style="color: #66cc66;">,</span> df<span style="color: #66cc66;">.</span>file_name<span style="color: #66cc66;">,</span> round<span style="color: #66cc66;">&#40;</span>df<span style="color: #66cc66;">.</span>user_bytes <span style="color: #66cc66;">/</span> 1024 <span style="color: #66cc66;">/</span> 1024<span style="color: #66cc66;">&#41;</span> total<span style="color: #66cc66;">,</span> round<span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>free<span style="color: #66cc66;">.</span>bytes<span style="color: #66cc66;">,</span>0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> 1024 <span style="color: #66cc66;">/</span> 1024<span style="color: #66cc66;">&#41;</span> libre
	          <span style="color: #993333; font-weight: bold;">from</span> dba_data_files df<span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> tablespace_name<span style="color: #66cc66;">,</span> file_id<span style="color: #66cc66;">,</span> sum<span style="color: #66cc66;">&#40;</span>bytes<span style="color: #66cc66;">&#41;</span> bytes <span style="color: #993333; font-weight: bold;">from</span> dba_free_space <span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> tablespace_name<span style="color: #66cc66;">,</span> file_id<span style="color: #66cc66;">&#41;</span> free
	          <span style="color: #993333; font-weight: bold;">where</span> free<span style="color: #66cc66;">.</span>file_id <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">+</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> df<span style="color: #66cc66;">.</span>file_id
            <span style="color: #993333; font-weight: bold;">and</span> free<span style="color: #66cc66;">.</span>tablespace_name <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">+</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> df<span style="color: #66cc66;">.</span>tablespace_name
            <span style="color: #993333; font-weight: bold;">union</span> <span style="color: #993333; font-weight: bold;">all</span>
            <span style="color: #993333; font-weight: bold;">select</span> df<span style="color: #66cc66;">.</span>tablespace_name<span style="color: #66cc66;">,</span> df<span style="color: #66cc66;">.</span>file_id<span style="color: #66cc66;">,</span> df<span style="color: #66cc66;">.</span>file_name<span style="color: #66cc66;">,</span> round<span style="color: #66cc66;">&#40;</span>df<span style="color: #66cc66;">.</span>user_bytes <span style="color: #66cc66;">/</span> 1024 <span style="color: #66cc66;">/</span> 1024<span style="color: #66cc66;">&#41;</span> total<span style="color: #66cc66;">,</span> round<span style="color: #66cc66;">&#40;</span>nvl<span style="color: #66cc66;">&#40;</span>free<span style="color: #66cc66;">.</span>bytes<span style="color: #66cc66;">,</span>0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> 1024 <span style="color: #66cc66;">/</span> 1024<span style="color: #66cc66;">&#41;</span> libre
	          <span style="color: #993333; font-weight: bold;">from</span> dba_temp_files df<span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> tablespace_name<span style="color: #66cc66;">,</span> file_id<span style="color: #66cc66;">,</span> sum<span style="color: #66cc66;">&#40;</span>bytes<span style="color: #66cc66;">&#41;</span> bytes <span style="color: #993333; font-weight: bold;">from</span> dba_free_space <span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> tablespace_name<span style="color: #66cc66;">,</span> file_id<span style="color: #66cc66;">&#41;</span> free
	          <span style="color: #993333; font-weight: bold;">where</span> free<span style="color: #66cc66;">.</span>file_id <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">+</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> df<span style="color: #66cc66;">.</span>file_id
            <span style="color: #993333; font-weight: bold;">and</span> free<span style="color: #66cc66;">.</span>tablespace_name <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">+</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> df<span style="color: #66cc66;">.</span>tablespace_name
     <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> tablespace_name<span style="color: #66cc66;">,</span> libre
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> tablespace_name;</pre></td></tr></table></div>

<p style="text-align: center;"><strong>Know the lock in database :</strong></p>

<div class="wp_codebox"><table width="100%" ><tr id="p1462"><td class="code" id="p146code2"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> a<span style="color: #66cc66;">.</span>object_name<span style="color: #66cc66;">,</span>
b<span style="color: #66cc66;">.</span>oracle_username<span style="color: #66cc66;">,</span> b<span style="color: #66cc66;">.</span>os_user_name<span style="color: #66cc66;">,</span>c<span style="color: #66cc66;">.</span>sid<span style="color: #66cc66;">,</span> c<span style="color: #66cc66;">.</span>serial<span style="color: #808080; font-style: italic;">#,c.terminal, d.sql_text</span>
<span style="color: #993333; font-weight: bold;">from</span> sys<span style="color: #66cc66;">.</span>dba_objects a<span style="color: #66cc66;">,</span>
v$locked_object b<span style="color: #66cc66;">,</span> v$session c<span style="color: #66cc66;">,</span> v$sqltext d
<span style="color: #993333; font-weight: bold;">where</span> a<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> b<span style="color: #66cc66;">.</span>object_id
<span style="color: #993333; font-weight: bold;">and</span> c<span style="color: #66cc66;">.</span>sid <span style="color: #66cc66;">=</span> b<span style="color: #66cc66;">.</span>session_id
<span style="color: #993333; font-weight: bold;">and</span> c<span style="color: #66cc66;">.</span>sql_hash_value <span style="color: #66cc66;">=</span> d<span style="color: #66cc66;">.</span>hash_value</pre></td></tr></table></div>

<p>or</p>

<div class="wp_codebox"><table width="100%" ><tr id="p1463"><td class="code" id="p146code3"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> session_id <span style="color: #ff0000;">&quot;sid&quot;</span><span style="color: #66cc66;">,</span>SERIAL<span style="color: #66cc66;">,</span> substr<span style="color: #66cc66;">&#40;</span>object_name<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Object&quot;</span><span style="color: #66cc66;">,</span>   substr<span style="color: #66cc66;">&#40;</span>os_user_name<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Terminal&quot;</span><span style="color: #66cc66;">,</span>  substr<span style="color: #66cc66;">&#40;</span>oracle_username<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Locker&quot;</span><span style="color: #66cc66;">,</span>
nvl<span style="color: #66cc66;">&#40;</span>lockwait<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'active'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Wait&quot;</span><span style="color: #66cc66;">,</span>  decode<span style="color: #66cc66;">&#40;</span>locked_mode<span style="color: #66cc66;">,</span>
   <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'row share'</span><span style="color: #66cc66;">,</span>
    <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'row exclusive'</span><span style="color: #66cc66;">,</span>
    <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'share'</span><span style="color: #66cc66;">,</span>
    <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'share row exclusive'</span><span style="color: #66cc66;">,</span>
    <span style="color: #cc66cc;">6</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'exclusive'</span><span style="color: #66cc66;">,</span>  <span style="color: #ff0000;">'unknown'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;Lockmode&quot;</span><span style="color: #66cc66;">,</span>
  OBJECT_TYPE <span style="color: #ff0000;">&quot;Type&quot;</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   SYS<span style="color: #66cc66;">.</span>V_$LOCKED_OBJECT A<span style="color: #66cc66;">,</span>   SYS<span style="color: #66cc66;">.</span>ALL_OBJECTS B<span style="color: #66cc66;">,</span>
SYS<span style="color: #66cc66;">.</span>V_$SESSION c <span style="color: #993333; font-weight: bold;">WHERE</span>
A<span style="color: #66cc66;">.</span>OBJECT_ID <span style="color: #66cc66;">=</span> B<span style="color: #66cc66;">.</span>OBJECT_ID <span style="color: #993333; font-weight: bold;">AND</span>
  C<span style="color: #66cc66;">.</span>SID <span style="color: #66cc66;">=</span> A<span style="color: #66cc66;">.</span>SESSION_ID
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> 1 <span style="color: #993333; font-weight: bold;">ASC</span><span style="color: #66cc66;">,</span> 5 <span style="color: #993333; font-weight: bold;">Desc</span></pre></td></tr></table></div>

<p style="text-align: center;"><strong>And know which SQL is taken the most resources :</strong></p>

<div class="wp_codebox"><table width="100%" ><tr id="p1464"><td class="code" id="p146code4"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">select</span> round<span style="color: #66cc66;">&#40;</span>buffer_gets<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>executions<span style="color: #66cc66;">+</span>1<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">as</span> gets_per_exec<span style="color: #66cc66;">,</span> executions<span style="color: #66cc66;">,</span> buffer_gets<span style="color: #66cc66;">,</span> elapsed_time<span style="color: #66cc66;">,</span> elapsed_time <span style="color: #66cc66;">/</span> executions time_per_exec<span style="color: #66cc66;">,</span> sql_text
<span style="color: #993333; font-weight: bold;">from</span> v$sqlarea
<span style="color: #993333; font-weight: bold;">where</span> buffer_gets<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>executions<span style="color: #66cc66;">+</span>1<span style="color: #66cc66;">&#41;</span> &amp;gt;<span style="color: #66cc66;">=</span> 20
<span style="color: #993333; font-weight: bold;">and</span> executions &amp;gt;<span style="color: #66cc66;">=</span> 1
<span style="color: #993333; font-weight: bold;">order</span> <span style="color: #993333; font-weight: bold;">by</span> buffer_gets <span style="color: #993333; font-weight: bold;">desc</span></pre></td></tr></table></div>


<p><a href="http://feedads.g.doubleclick.net/~a/XkETpL3q8TuFTX5_BiWfprbDzW4/0/da"><img src="http://feedads.g.doubleclick.net/~a/XkETpL3q8TuFTX5_BiWfprbDzW4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/XkETpL3q8TuFTX5_BiWfprbDzW4/1/da"><img src="http://feedads.g.doubleclick.net/~a/XkETpL3q8TuFTX5_BiWfprbDzW4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/EE6bi8GQrEM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/04/11/the-three-sql-oracle-which-will-rescue-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/04/11/the-three-sql-oracle-which-will-rescue-you/</feedburner:origLink></item>
		<item>
		<title>Number of messages in JMS MQ Queue</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/2hzz98ZvewE/</link>
		<comments>http://en.c-ba.org/2009/03/25/number-of-messages-in-jms-mq-queue/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 22:23:10 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[developping]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[MQ Series]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=143</guid>
		<description><![CDATA[
Goodnight,
Here a little tips. This little function allow you to get the number of messages actually in the JMS MQ Queue.

public int getNumberOfMessages&#40;&#41; throws ErrorHandlingException
&#123;
        MQQueueManager manager = null;
        MQQueue realQ = null;
        try
 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.c-ba.org/wp-content/uploads/2009/03/cafe-1.jpg"><img class="size-full wp-image-532 aligncenter" title="cafe-1" src="http://www.c-ba.org/wp-content/uploads/2009/03/cafe-1.jpg" alt="cafe-1" width="242" height="230" /></a></p>
<p>Goodnight,<br />
Here a little tips. This little function allow you to get the number of messages actually in the JMS MQ Queue.</p>

<div class="wp_codebox"><table width="100%" ><tr id="p1436"><td class="code" id="p143code6"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getNumberOfMessages<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ErrorHandlingException
<span style="color: #009900;">&#123;</span>
        MQQueueManager manager <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        MQQueue realQ <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// The default option for accessing queue</span>
            <span style="color: #000066; font-weight: bold;">int</span> openOptions <span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQOO_INQUIRE</span><span style="color: #339933;">;</span>
&nbsp;
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainitialcontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InitialContext</span></a> ctx <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainitialcontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InitialContext</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Get the JNDI object of the queue</span>
            Queue queue <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Queue<span style="color: #009900;">&#41;</span> ctx.<span style="color: #006633;">lookup</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;QueueName&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Cast it into the real object MQQUeue JMS if it is allowed</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>queue <span style="color: #000000; font-weight: bold;">instanceof</span> com.<span style="color: #006633;">ibm</span>.<span style="color: #006633;">mq</span>.<span style="color: #006633;">jms</span>.<span style="color: #006633;">MQQueue</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #666666; font-style: italic;">// The casting</span>
                com.<span style="color: #006633;">ibm</span>.<span style="color: #006633;">mq</span>.<span style="color: #006633;">jms</span>.<span style="color: #006633;">MQQueue</span> queueJMS <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>com.<span style="color: #006633;">ibm</span>.<span style="color: #006633;">mq</span>.<span style="color: #006633;">jms</span>.<span style="color: #006633;">MQQueue</span><span style="color: #009900;">&#41;</span> queue<span style="color: #339933;">;</span>
                <span style="color: #666666; font-style: italic;">// Retrive manager name and real queue name (different from JNDI)</span>
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> managerName <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>queueJMS<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBaseQueueManagerName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> queueName <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>queueJMS<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBaseQueueName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// Make a Queue Manager link</span>
                <span style="color: #666666; font-style: italic;">// Do not need to specify more attributes</span>
                <span style="color: #666666; font-style: italic;">// Because the manager must be local !</span>
                manager <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MQQueueManager<span style="color: #009900;">&#40;</span>managerName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// Accessing to queue</span>
                realQ <span style="color: #339933;">=</span> manager.<span style="color: #006633;">accessQueue</span><span style="color: #009900;">&#40;</span>queueName, openOptions<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// And returnning some values</span>
                <span style="color: #000000; font-weight: bold;">return</span> realQ.<span style="color: #006633;">getCurrentDepth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
            <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Bad news it is not a MQ Queue</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Anamingexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">NamingException</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">finally</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//Trying to close some ressources</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>realQ <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">try</span>
                <span style="color: #009900;">&#123;</span>
                    realQ.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>MQException e<span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>manager <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">try</span>
                <span style="color: #009900;">&#123;</span>
                    manager.<span style="color: #006633;">disconnect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>MQException e<span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Ok it is working but I only try with a queue and a manager local. I don&#8217;t know if it will work with a remote queue.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/JCREmR5Km2SUH1kpQv6nEa3IlSQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/JCREmR5Km2SUH1kpQv6nEa3IlSQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/JCREmR5Km2SUH1kpQv6nEa3IlSQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/JCREmR5Km2SUH1kpQv6nEa3IlSQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/2hzz98ZvewE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/03/25/number-of-messages-in-jms-mq-queue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/03/25/number-of-messages-in-jms-mq-queue/</feedburner:origLink></item>
		<item>
		<title>Number of messages waiting into a Weblogic JMS Queue</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/K5IEG74-SxY/</link>
		<comments>http://en.c-ba.org/2009/03/04/number-of-messages-waiting-into-a-weblogic-jms-queue/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 22:52:42 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jms]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[weblogic]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=131</guid>
		<description><![CDATA[
Goodnight,
This little tips help you to solve a little problem. The purpose is to retrieve the number of messages currently in a JMS Queue on a recent Weblogic Server (version &#62;=  9).

try
&#123;
	InitialContext ctx = new InitialContext&#40;&#41;;
	JMSDestinationRuntimeMBean jd = JMSModuleHelper.getJMSDestinationRuntimeMBean&#40;ctx,
			&#34;MyJMSServer&#34;, &#34;MyMoodule!MyQueue&#34;&#41;;
	taille = new Long&#40;jd.getMessagesCurrentCount&#40;&#41;&#41;.intValue&#40;&#41;;
&#125;
catch &#40;Exception e&#41;
&#123;
	// manage exception
&#125;

And it is done. You just have to know [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.c-ba.org/wp-content/uploads/2009/03/186-019coffee-posters.jpg"><img class="size-full wp-image-430 aligncenter" title="186-019coffee-posters" src="http://www.c-ba.org/wp-content/uploads/2009/03/186-019coffee-posters.jpg" alt="186-019coffee-posters" width="186" height="237" /></a></p>
<p>Goodnight,<br />
This little tips help you to solve a little problem. The purpose is to retrieve the number of messages currently in a JMS Queue on a recent Weblogic Server (version &gt;=  9).</p>

<div class="wp_codebox"><table width="100%" ><tr id="p1319"><td class="code" id="p131code9"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">try</span>
<span style="color: #009900;">&#123;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainitialcontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InitialContext</span></a> ctx <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainitialcontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InitialContext</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	JMSDestinationRuntimeMBean jd <span style="color: #339933;">=</span> JMSModuleHelper.<span style="color: #006633;">getJMSDestinationRuntimeMBean</span><span style="color: #009900;">&#40;</span>ctx,
			<span style="color: #0000ff;">&quot;MyJMSServer&quot;</span>, <span style="color: #0000ff;">&quot;MyMoodule!MyQueue&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	taille <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Along+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Long</span></a><span style="color: #009900;">&#40;</span>jd.<span style="color: #006633;">getMessagesCurrentCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">intValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// manage exception</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And it is done. You just have to know you JMS server name. That&#8217;s easy to find in the administration console of Weblogic. The name of the queue is a little hard to find because you need to prefix it with the module name.<br />
But I can help you, here some code to print each queue name in a Weblogic JMS server:</p>

<div class="wp_codebox"><table width="100%" ><tr id="p13110"><td class="code" id="p131code10"><pre class="java" style="font-family:monospace;">JMSServerRuntimeMBean jms <span style="color: #339933;">=</span> JMSModuleHelper.<span style="color: #006633;">getJMSServerRuntimeMBean</span><span style="color: #009900;">&#40;</span>ctx, <span style="color: #0000ff;">&quot;MyJMSServer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span> JMSDestinationRuntimeMBean q <span style="color: #339933;">:</span> jms.<span style="color: #006633;">getDestinations</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>q.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>q.<span style="color: #006633;">getMessagesCurrentCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Ok, See you later&#8230; Be Strong and don&#8217;t forget what SkinRed has said:</p>
<p style="text-align: center;"><strong><em>I had not thought to be just as messy, but the facts are there<br />
since I placed my room the strength of my WiFi signal<br />
went from &#8220;very low&#8221; to &#8220;good&#8221;</em><em></em></strong></p>

<p><a href="http://feedads.g.doubleclick.net/~a/G8M3LmLvh0g0l-qLwbw0lQSmVqI/0/da"><img src="http://feedads.g.doubleclick.net/~a/G8M3LmLvh0g0l-qLwbw0lQSmVqI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/G8M3LmLvh0g0l-qLwbw0lQSmVqI/1/da"><img src="http://feedads.g.doubleclick.net/~a/G8M3LmLvh0g0l-qLwbw0lQSmVqI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/K5IEG74-SxY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/03/04/number-of-messages-waiting-into-a-weblogic-jms-queue/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/03/04/number-of-messages-waiting-into-a-weblogic-jms-queue/</feedburner:origLink></item>
		<item>
		<title>StAX a three’years old way for reading XML</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/PdgUylETNww/</link>
		<comments>http://en.c-ba.org/2009/02/27/stax-a-new-way-for-reading-xml/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 22:16:23 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[developping]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[StAX]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[Woodstox]]></category>
		<category><![CDATA[writer]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=124</guid>
		<description><![CDATA[When we was studying our application to parse some XML, with have seen there three methods to do it:

First one DOM with JDOM or DOM4J which parse XML into Element or Attribut object
SAX with Xerces which parse XML without instantciate object
And StAX which is similare as SAX but with better performance.

Why StAX is more performant [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.c-ba.org/wp-content/uploads/2009/02/stax.jpg"><img class="size-full wp-image-403 alignright" title="stax" src="http://www.c-ba.org/wp-content/uploads/2009/02/stax.jpg" alt="stax" width="227" height="350" /></a>When we was studying our application to parse some XML, with have seen there three methods to do it:</p>
<ul>
<li>First one DOM with JDOM or DOM4J which parse XML into Element or Attribut object</li>
<li>SAX with Xerces which parse XML without instantciate object</li>
<li>And StAX which is similare as SAX but with better performance.</li>
</ul>
<p>Why StAX is more performant ? Because It reading stream (outputstream or writter) by pull method. And Sax is by pushing. That made it more performant and it is good.</p>
<p>How to use StAX. Xerces and BEA make an implementation. But the one seems to be Woodstox. This version is very good and better in performance. Ho Yes, StAX is a specification. May you look it on google and if you found it let a comment ,).</p>
<p>Ok let&#8217;s check how to read a XML. The StAX work with sort event  like if you were reading the flow. Things like : Starting Element, Reading Text, Ending Element.</p>
<p>When the event is a starting event then you can acess to attributes.</p>

<div class="wp_codebox"><table width="100%" ><tr id="p12414"><td class="code" id="p124code14"><pre class="java" style="font-family:monospace;">XMLInputFactory2 factory <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>XMLInputFactory2<span style="color: #009900;">&#41;</span> XMLInputFactory2.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Tel factory do right things</span>
factory.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span>XMLInputFactory.<span style="color: #006633;">IS_REPLACING_ENTITY_REFERENCES</span>,
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aboolean+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Boolean</span></a>.<span style="color: #000066; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
factory.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span>XMLInputFactory.<span style="color: #006633;">IS_SUPPORTING_EXTERNAL_ENTITIES</span>,
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aboolean+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Boolean</span></a>.<span style="color: #000066; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
factory.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span>XMLInputFactory.<span style="color: #006633;">IS_COALESCING</span>,
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aboolean+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Boolean</span></a>.<span style="color: #000066; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// optimize all for speed</span>
<span style="color: #666666; font-style: italic;">// you could optimize for memory usage or for xml compliance</span>
factory.<span style="color: #006633;">configureForSpeed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Building a reader and use it like an Iterator</span>
XMLStreamReader2 reader <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>XMLStreamReader2<span style="color: #009900;">&#41;</span> factory.<span style="color: #006633;">createXMLStreamReader</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">&quot;fichier.xml&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afileinputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">FileInputStream</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;fichier.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> eventType <span style="color: #339933;">=</span>	xmlr.<span style="color: #006633;">getEventType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>reader.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	eventType <span style="color: #339933;">=</span> reader.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>eventType<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">case</span> XMLEvent.<span style="color: #006633;">START_ELEMENT</span><span style="color: #339933;">:</span>
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Start Element : &quot;</span> <span style="color: #339933;">+</span> reader.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// You can access attribute here getAttributeValue or getAttributeName</span>
			<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">case</span> XMLEvent.<span style="color: #006633;">END_ELEMENT</span><span style="color: #339933;">:</span>
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;End Element : &quot;</span> <span style="color: #339933;">+</span> reader.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Other event type     </span>
		<span style="color: #666666; font-style: italic;">/*
			* START_DOCUMENT
			* END_DOCUMENT
			* START_ELEMENT
			* END_ELEMENT
			* ENTITY_DECLARATION
			* ENTITY_REFRERENCE
    			* NAMESPACE
    			* CDATA
    			* CHARACTERS
    			* COMMENTS
    			* ATTRIBUTE
    			* PROCESSING_INSTRUCTION
		*/</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And now how to write XML, let&#8217;s just check code it is simple:</p>

<div class="wp_codebox"><table width="100%" ><tr id="p12415"><td class="code" id="p124code15"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Encore une factory</span>
XMLInputFactory2 factory <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>XMLInputFactory2<span style="color: #009900;">&#41;</span> XMLInputFactory2.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abytearrayoutputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">ByteArrayOutputStream</span></a> bos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abytearrayoutputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">ByteArrayOutputStream</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> encStr <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">;</span>
sw <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>XMLStreamWriter2<span style="color: #009900;">&#41;</span> f.<span style="color: #006633;">createXMLStreamWriter</span><span style="color: #009900;">&#40;</span>bos, encStr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
sw.<span style="color: #006633;">writeStartDocument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sw.<span style="color: #006633;">writeStartElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sw.<span style="color: #006633;">writeAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span>,<span style="color: #0000ff;">&quot;value&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sw.<span style="color: #006633;">writeEndElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sw.<span style="color: #006633;">writeEndDocument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// And close</span>
sw.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bos.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Now you are greater than ever!</p>
<p>A litle tips for using Woodstox on Weblogic server put this line into weblogic.xml:</p>

<div class="wp_codebox"><table width="100%" ><tr id="p12416"><td class="code" id="p124code16"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;container-descriptor<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prefer-web-inf-classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prefer-web-inf-classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/container-descriptor<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Yes because these servers got there own implementation which could raise some casting errors with my code.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/cwXxpMGu6vYaZtNWe-IXMnVAKsY/0/da"><img src="http://feedads.g.doubleclick.net/~a/cwXxpMGu6vYaZtNWe-IXMnVAKsY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cwXxpMGu6vYaZtNWe-IXMnVAKsY/1/da"><img src="http://feedads.g.doubleclick.net/~a/cwXxpMGu6vYaZtNWe-IXMnVAKsY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/PdgUylETNww" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/02/27/stax-a-new-way-for-reading-xml/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/02/27/stax-a-new-way-for-reading-xml/</feedburner:origLink></item>
		<item>
		<title>RSS URL need to be update</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/_DynA5DGU0A/</link>
		<comments>http://en.c-ba.org/2009/02/24/rss-url-need-to-be-update/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 10:36:54 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[something to tell]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=122</guid>
		<description><![CDATA[My URL for my RSS need to be update, here the new one :
http://feeds2.feedburner.com/EnglishCba
The previous one will continue to work. I am just need some stats thaht Google Analytics doesn&#8217;t provide
]]></description>
			<content:encoded><![CDATA[<p>My URL for my RSS need to be update, here the new one :</p>
<p><a href="http://feeds2.feedburner.com/EnglishCba">http://feeds2.feedburner.com/EnglishCba</a></p>
<p>The previous one will continue to work. I am just need some stats thaht Google Analytics doesn&#8217;t provide</p>

<p><a href="http://feedads.g.doubleclick.net/~a/9hHNgVnroyfGhEtBOQRxB7--K14/0/da"><img src="http://feedads.g.doubleclick.net/~a/9hHNgVnroyfGhEtBOQRxB7--K14/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/9hHNgVnroyfGhEtBOQRxB7--K14/1/da"><img src="http://feedads.g.doubleclick.net/~a/9hHNgVnroyfGhEtBOQRxB7--K14/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/_DynA5DGU0A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/02/24/rss-url-need-to-be-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/02/24/rss-url-need-to-be-update/</feedburner:origLink></item>
		<item>
		<title>Track page generation time and number of request per page into Google Analytics</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/2ccpQHYJ8IE/</link>
		<comments>http://en.c-ba.org/2009/02/13/track-page-generation-time-and-number-of-request-per-page-into-google-analytics/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 16:10:22 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[developping]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=110</guid>
		<description><![CDATA[So you want to track into google analytics number of requests per page and the generation time for each page. It is easy. I took for example the blog system Wordpress.
Just put this line in your theme footer :

&#60;!-- &#60;? $ttime = floatval&#40;timer_stop&#40;1&#41;&#41;*1000; ?&#62; --/&#62; 
&#60;script type=&#34;text/javascript&#34;&#62; 
	var gaJsHost = &#40;&#40;&#34;https:&#34; == document.location.protocol&#41; ? &#34;https://ssl.&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to track into google analytics number of requests per page and the generation time for each page. It is easy. I took for example the blog system Wordpress.</p>
<p>Just put this line in your theme footer :</p>

<div class="wp_codebox"><table width="100%" ><tr id="p11018"><td class="code" id="p110code18"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> <span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #000088;">$ttime</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floatval"><span style="color: #990000;">floatval</span></a><span style="color: #009900;">&#40;</span>timer_stop<span style="color: #009900;">&#40;</span>1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">--/&gt;</span> 
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
	<span style="color: #000000; font-weight: bold;">var</span> gaJsHost <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;https:&quot;</span> <span style="color: #339933;">==</span> document<span style="color: #339933;">.</span>location<span style="color: #339933;">.</span>protocol<span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;https://ssl.&quot;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;http://www.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	document<span style="color: #339933;">.</span>write<span style="color: #009900;">&#40;</span>unescape<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%3Cscript src='&quot;</span> <span style="color: #339933;">+</span> gaJsHost <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;google-analytics.com/ga.js' 
	type='text/javascript'%3E%3C/script%3E&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span> <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
	<span style="color: #000000; font-weight: bold;">var</span> pageTracker <span style="color: #339933;">=</span> _gat<span style="color: #339933;">.</span>_getTracker<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;XXXXXXXX&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	pageTracker<span style="color: #339933;">.</span>_setAllowLinker<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	pageTracker<span style="color: #339933;">.</span>_trackPageview<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	pageTracker<span style="color: #339933;">.</span>_trackEvent<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;wordpress&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;generationTime&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ttime</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	pageTracker<span style="color: #339933;">.</span>_trackEvent<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;wordpress&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;sqlRequests&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_num_queries<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></td></tr></table></div>

<p>This script tracks the page view, and two events:<br />
one for generation time with the wordpress php function time_stop and the other for number of request with get_num_queries. (Don&#8217;t forget to replace XXXXX bu your google anlytics one)</p>
<p>You can find more informations about tracking event here :<br />
<a href="http://code.google.com/apis/analytics/docs/gaJSApi.html">http://code.google.com/apis/analytics/docs/gaJSApi.html</a></p>
<p>After to see some reports (wait one or two days before), go here :<br />
<a href="https://www.google.com/analytics/reporting/events">https://www.google.com/analytics/reporting/events</a></p>
<p>And then you could see some reports like that :</p>
<p><a href="http://www.c-ba.org/wp-content/uploads/2009/02/event.jpg"><img class="size-full wp-image-357 alignleft" title="event" src="http://www.c-ba.org/wp-content/uploads/2009/02/event.jpg" alt="event" width="368" height="63" /></a></p>
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: left;">Average request per page 20 and average generation time is 793 ms.</p>
<p><a href="http://www.c-ba.org/wp-content/uploads/2009/02/graph.jpg"><img class="size-full wp-image-358 alignleft" title="graph" src="http://www.c-ba.org/wp-content/uploads/2009/02/graph.jpg" alt="graph" width="225" height="177" /></a></p>
<p style="text-align: left;">This service is actually in beta-testing&#8230; But I am guessing that  we could make some nice things with configurable reports with this new feature.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/JI-9tjnXRLjpOT6D1NhVPo_oh3A/0/da"><img src="http://feedads.g.doubleclick.net/~a/JI-9tjnXRLjpOT6D1NhVPo_oh3A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/JI-9tjnXRLjpOT6D1NhVPo_oh3A/1/da"><img src="http://feedads.g.doubleclick.net/~a/JI-9tjnXRLjpOT6D1NhVPo_oh3A/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/2ccpQHYJ8IE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/02/13/track-page-generation-time-and-number-of-request-per-page-into-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/02/13/track-page-generation-time-and-number-of-request-per-page-into-google-analytics/</feedburner:origLink></item>
		<item>
		<title>Catch deploy and undeploy event with Tomcat</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/OnMIR55Vyf0/</link>
		<comments>http://en.c-ba.org/2009/01/10/catch-deploy-and-undeploy-event-with-tomcat/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 22:53:49 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=97</guid>
		<description><![CDATA[How to catch undeploy event on a webapp under Tomcat ?
It is easy. You must make a class which herits of  javax.servlet.ServletContextListener when overide function contextDestroyed for undeploy event.
Here some sources :

package mypkg.c; 
&#160;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent; 
&#160;
public class MyServletContextListener implements ServletContextListener&#123; 
&#160;
/**Cette méthode appelée lors du démarrage de l'application*/
public void contextInitialized&#40;ServletContextEvent sce&#41;&#123;
	System.out.println&#40;&#34;Application is starting&#34;&#41;;
&#125; 
&#160;
/**Cette [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.c-ba.org/wp-content/uploads/2009/01/tomcat.gif"><img class="size-full wp-image-100 alignright" title="tomcat" src="http://en.c-ba.org/wp-content/uploads/2009/01/tomcat.gif" alt="tomcat" width="130" height="92" /></a>How to catch undeploy event on a webapp under Tomcat ?</p>
<p>It is easy. You must make a class which herits of  <span class="java_code">javax.servlet.ServletContextListener when overide function </span><span class="java_code">contextDestroyed for undeploy event.</span></p>
<p><span class="java_code">Here some sources :</span></p>

<div class="wp_codebox"><table width="100%" ><tr id="p9721"><td class="code" id="p97code21"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">mypkg.c</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.ServletContextListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.ServletContextEvent</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyServletContextListener <span style="color: #000000; font-weight: bold;">implements</span> ServletContextListener<span style="color: #009900;">&#123;</span> 
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**Cette méthode appelée lors du démarrage de l'application*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> contextInitialized<span style="color: #009900;">&#40;</span>ServletContextEvent sce<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Application is starting&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**Cette méthode appelée lors de l'arret de l'application*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> contextDestroyed<span style="color: #009900;">&#40;</span>ServletContextEvent sce<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Application is stopped&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And don&#8217;t forget to declare it on the web.xml :</p>

<div class="wp_codebox"><table width="100%" ><tr id="p9722"><td class="code" id="p97code22"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mypkg.c.MyServletContextListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>


<p><a href="http://feedads.g.doubleclick.net/~a/4rUh-8baf_6PrLRVClVm-kIN3ys/0/da"><img src="http://feedads.g.doubleclick.net/~a/4rUh-8baf_6PrLRVClVm-kIN3ys/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4rUh-8baf_6PrLRVClVm-kIN3ys/1/da"><img src="http://feedads.g.doubleclick.net/~a/4rUh-8baf_6PrLRVClVm-kIN3ys/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/OnMIR55Vyf0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2009/01/10/catch-deploy-and-undeploy-event-with-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2009/01/10/catch-deploy-and-undeploy-event-with-tomcat/</feedburner:origLink></item>
		<item>
		<title>A bot for twitter : impossible</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/WIgnZOO5jes/</link>
		<comments>http://en.c-ba.org/2008/12/05/a-bot-for-twitter-impossible/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 23:06:38 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[something to tell]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=94</guid>
		<description><![CDATA[I started to develop a bot for twitter. This bot will ask player some question, the first person to correctly answer win one points. But It doesn&#8217;t work ! Why ? because Twitter is limit by 70 request per hour. That&#8217;s mean that it cannont be done !!
Nevermind, I changed my mind and I am [...]]]></description>
			<content:encoded><![CDATA[<p>I started to develop a bot for twitter. This bot will ask player some question, the first person to correctly answer win one points. But It doesn&#8217;t work ! Why ? because Twitter is limit by 70 request per hour. That&#8217;s mean that it cannont be done !!</p>
<p>Nevermind, I changed my mind and I am going to develop a google talk bot on the same idea.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/LY9eOQDapCHf90KLfF7mf-iacEY/0/da"><img src="http://feedads.g.doubleclick.net/~a/LY9eOQDapCHf90KLfF7mf-iacEY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LY9eOQDapCHf90KLfF7mf-iacEY/1/da"><img src="http://feedads.g.doubleclick.net/~a/LY9eOQDapCHf90KLfF7mf-iacEY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/WIgnZOO5jes" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2008/12/05/a-bot-for-twitter-impossible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2008/12/05/a-bot-for-twitter-impossible/</feedburner:origLink></item>
		<item>
		<title>How to have multi site under one profile into Google Analytics</title>
		<link>http://feedproxy.google.com/~r/EnglishCba/~3/8xIZT82dp2k/</link>
		<comments>http://en.c-ba.org/2008/11/21/how-to-have-multi-site-under-one-profile-into-google-analytics/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 12:54:19 +0000</pubDate>
		<dc:creator>cba</dc:creator>
				<category><![CDATA[developping]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://en.c-ba.org/?p=80</guid>
		<description><![CDATA[I have three personals websites and I made one profile for each into Google Analytics. But every day, when I come to see my visists&#8217; numbers, It was long to check all profile. So I started to manage all my websites into one profile.
In fact, there is not a lot of things to do. It [...]]]></description>
			<content:encoded><![CDATA[<p>I have three personals websites and I made one profile for each into Google Analytics. But every day, when I come to see my visists&#8217; numbers, It was long to check all profile. So I started to manage all my websites into one profile.</p>
<p>In fact, there is not a lot of things to do. It is a 3 steps goals.</p>
<ol>
<li>Add the same javascript code to all your websites. Before starting my modification, I took a look to Analytics&#8217;s help pages and I found this : <a href="http://www.google.com/support/analytics/bin/answer.py?answer=55503">http://www.google.com/support/analytics/bin/answer.py?answer=55503</a>.<br />
The perfect help. It tell me what code to insert and how to do it. Yes because you need to add two new line to the default javascript&#8217;s code.</li>
<li>You must a specific filter. Because in fact, overwise, the URL websites will be mixed. In fact, Google Analytics just keep that is after the domain name into url. For example, when user access to my by this URL http://en.c-ba.org will, it appear with this name under Google Analytics : &#8220;/&#8221;.<br />
So you need to force the hostname to be put before URL name. This is described into the Google&#8217;s analytics&#8217;s page gived into the previous paragraph. You must edit your profile and this filter :</p>
<p style="text-align: center;"><a href="http://en.c-ba.org/wp-content/uploads/2008/11/filtre.jpg"><img class="size-medium wp-image-83 aligncenter" title="filtre" src="http://en.c-ba.org/wp-content/uploads/2008/11/filtre-300x211.jpg" alt="" width="300" height="211" /></a></p>
</li>
<li>You must build a specific segment for each host you got. To create a new segment click on Manage Advanced Segments on left&#8217;s menu and then on &#8216;Create Advanced Segment&#8217; link.
<div id="custom-breadcrumb" class="breadcrumb"><span> Choose &#8216;Hostname&#8217; value, choose &#8216;contains&#8217; under the select box and insert your hostname for your website. For example : &#8216;en.c-ba.org&#8217;. Verify what the case sensitive checkbox is uncheck. Then save. (Segment is effective immediatly)<br />
</span></div>
</li>
</ol>
<p>Your Google Analytics is configured you must now wait one or two days for data retriving.<br />
The next day you must choose into advanced segment, one you like to see into graph. Here some screenshoots. (I have three blogs : one in french, this one in english and a photoblog)</p>
<p style="text-align: center;"><a href="http://en.c-ba.org/wp-content/uploads/2008/11/segment.jpg"><img class="alignnone size-full wp-image-84" title="segment" src="http://en.c-ba.org/wp-content/uploads/2008/11/segment.jpg" alt="" width="500" height="190" /></a></p>
<p style="text-align: center;"><a href="http://en.c-ba.org/wp-content/uploads/2008/11/visits.jpg"><img class="alignnone size-full wp-image-85" title="visits" src="http://en.c-ba.org/wp-content/uploads/2008/11/visits.jpg" alt="" width="500" height="100" /></a></p>
<p style="text-align: center;"><a href="http://en.c-ba.org/wp-content/uploads/2008/11/visitperhour.jpg"><img class="alignnone size-full wp-image-86" title="visitperhour" src="http://en.c-ba.org/wp-content/uploads/2008/11/visitperhour.jpg" alt="" width="500" height="229" /></a></p>
<p style="text-align: center;"><a href="http://en.c-ba.org/wp-content/uploads/2008/11/visits.jpg"><br />
</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/99ZI7nYHMMOOroXxU96j1pXTlvo/0/da"><img src="http://feedads.g.doubleclick.net/~a/99ZI7nYHMMOOroXxU96j1pXTlvo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/99ZI7nYHMMOOroXxU96j1pXTlvo/1/da"><img src="http://feedads.g.doubleclick.net/~a/99ZI7nYHMMOOroXxU96j1pXTlvo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EnglishCba/~4/8xIZT82dp2k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://en.c-ba.org/2008/11/21/how-to-have-multi-site-under-one-profile-into-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://en.c-ba.org/2008/11/21/how-to-have-multi-site-under-one-profile-into-google-analytics/</feedburner:origLink></item>
	</channel>
</rss>
