<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Chirashi Security &#187; HOWTO</title>
	<atom:link href="http://chirashi.zensay.com/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://chirashi.zensay.com</link>
	<description>a blog with scattered thoughts on security.</description>
	<lastBuildDate>Sun, 25 Jul 2010 05:25:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>InputStream to ByteArray on a BlackBerry</title>
		<link>http://chirashi.zensay.com/2010/01/inputstream-to-bytearray-on-a-blackberry/</link>
		<comments>http://chirashi.zensay.com/2010/01/inputstream-to-bytearray-on-a-blackberry/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 03:53:05 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=473</guid>
		<description><![CDATA[A quick and easy method to read an InputStream to a byte array is available in the IOUtilities class of the BlackBerry API.  I didn&#8217;t check if this is available pre 4.6 or not, but it does exist in 4.6
To read an InputStream directly to a byte array you can do something like this:

1
2
3
FileConnector fconn [...]]]></description>
			<content:encoded><![CDATA[<p>A quick and easy method to read an InputStream to a byte array is available in the <a href="http://www.blackberry.com/developers/docs/4.6.0api/net/rim/device/api/io/IOUtilities.html">IOUtilities</a> class of the BlackBerry API.  I didn&#8217;t check if this is available pre 4.6 or not, but it does exist in 4.6</p>
<p>To read an InputStream directly to a byte array you can do something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">FileConnector fconn <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FileConnector<span style="color: #009900;">&#41;</span>Connector.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;testfile.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">InputStream</span> inStream <span style="color: #339933;">=</span> fconn.<span style="color: #006633;">openInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> byteData <span style="color: #339933;">=</span> IOUtilities.<span style="color: #006633;">streamToBytes</span><span style="color: #009900;">&#40;</span>inStream<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>




Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;title=InputStream%20to%20ByteArray%20on%20a%20BlackBerry&amp;bodytext=A%20quick%20and%20easy%20method%20to%20read%20an%20InputStream%20to%20a%20byte%20array%20is%20available%20in%20the%20IOUtilities%20class%20of%20the%20BlackBerry%20API.%20%C2%A0I%20didn%27t%20check%20if%20this%20is%20available%20pre%204.6%20or%20not%2C%20but%20it%20does%20exist%20in%204.6%0D%0A%0D%0ATo%20read%20an%20InputStream%20directly%20to%20a%20byte%20ar" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;title=InputStream%20to%20ByteArray%20on%20a%20BlackBerry&amp;notes=A%20quick%20and%20easy%20method%20to%20read%20an%20InputStream%20to%20a%20byte%20array%20is%20available%20in%20the%20IOUtilities%20class%20of%20the%20BlackBerry%20API.%20%C2%A0I%20didn%27t%20check%20if%20this%20is%20available%20pre%204.6%20or%20not%2C%20but%20it%20does%20exist%20in%204.6%0D%0A%0D%0ATo%20read%20an%20InputStream%20directly%20to%20a%20byte%20ar" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;t=InputStream%20to%20ByteArray%20on%20a%20BlackBerry" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;title=InputStream%20to%20ByteArray%20on%20a%20BlackBerry&amp;annotation=A%20quick%20and%20easy%20method%20to%20read%20an%20InputStream%20to%20a%20byte%20array%20is%20available%20in%20the%20IOUtilities%20class%20of%20the%20BlackBerry%20API.%20%C2%A0I%20didn%27t%20check%20if%20this%20is%20available%20pre%204.6%20or%20not%2C%20but%20it%20does%20exist%20in%204.6%0D%0A%0D%0ATo%20read%20an%20InputStream%20directly%20to%20a%20byte%20ar" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;title=InputStream%20to%20ByteArray%20on%20a%20BlackBerry" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;title=InputStream%20to%20ByteArray%20on%20a%20BlackBerry" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F&amp;t=InputStream%20to%20ByteArray%20on%20a%20BlackBerry&amp;s=A%20quick%20and%20easy%20method%20to%20read%20an%20InputStream%20to%20a%20byte%20array%20is%20available%20in%20the%20IOUtilities%20class%20of%20the%20BlackBerry%20API.%20%C2%A0I%20didn%27t%20check%20if%20this%20is%20available%20pre%204.6%20or%20not%2C%20but%20it%20does%20exist%20in%204.6%0D%0A%0D%0ATo%20read%20an%20InputStream%20directly%20to%20a%20byte%20ar" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=InputStream%20to%20ByteArray%20on%20a%20BlackBerry%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=InputStream%20to%20ByteArray%20on%20a%20BlackBerry&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2010%2F01%2Finputstream-to-bytearray-on-a-blackberry%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2010/01/inputstream-to-bytearray-on-a-blackberry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>App World Dynamic Licensing HOWTO</title>
		<link>http://chirashi.zensay.com/2009/12/app-world-dynamic-licensing-howto/</link>
		<comments>http://chirashi.zensay.com/2009/12/app-world-dynamic-licensing-howto/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 09:30:39 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Activation Code]]></category>
		<category><![CDATA[App World]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Licensing]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=452</guid>
		<description><![CDATA[I started releasing commercial applications on BlackBerry App World and yesterday was the first time I used the Dynamic Licensing model.  I devised a quick solution for working with Dynamic Licensing based on Google App Engine and this post shows how this can be achieved and also includes sample source code for other developers in [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I started releasing commercial applications on BlackBerry App World and yesterday was the first time I used the Dynamic Licensing model.  I devised a quick solution for working with Dynamic Licensing based on Google App Engine and this post shows how this can be achieved and also includes sample source code for other developers in a similar situation.  Dynamic Licensing provides a mechanism for granting activation codes to user who purchase applications.  The system works like this:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">As with almost all commercial, downloadable applications, online purchase and activation codes have become the norm.  The end-user pays for the product, downloads it and waits for an activation code to be sent to his email address.  Once he receives the code, he enters it into the app and he can begin using it.  This is straightforward if the developer sells the app on his own store that is hosted on his own server.  If he is to sell it on other stores, however, things become tricky.  Usually, well established stores like MobiHand and others have a mechanism that allows a developer to interface with their storefront for various purposes.  One of these instances is when activation codes are involved.  In cases like these, here is a quick run-down of how the purchase flow works:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1. End-user visits Online Store</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2. End-user buys app from the Online Store</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3. Online Store contacts the Developer Server (using an HTTP POST request) with end-user specific details</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">4. Developer Server generates the activation key</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">5. Developer Server responds to the Online Store POST request with an activation key</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">6. Online Store then presents this activation key to the End-user</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">It is the Developer&#8217;s responsibility to get his activation server up and running to ensure steps 3-5 are completed.  Sometimes this can be a painful task; especially after you&#8217;ve spent a few grueling weeks in developing your latest and greatest application.  Here then are the steps to help simplify the process:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">My solution is to setup a free account on Google App Engine to host my activation server routines there.  Why bother you ask?  Here are some advantages that I can see:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1. App Engine is free and can easily be converted to a paid model (reasonably priced) based only on usage of resources</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2. App Engine offers Java so its more likely to be familiar to a BlackBerry developer</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3. No administrative overhead with setting up a server or maintaining it</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">4. It&#8217;s cool if you like to get into &#8220;Cloud Computing&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">5. It&#8217;s very easy to move off Google App Engine and onto your own server when you&#8217;re ready because of the standardized modules</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I&#8217;m not going to talk you through how to get an account, sign-up, etc.  Google has tons of docs and tutorials on how to do so.  I&#8217;ll assume you&#8217;ve already got your App Engine and know how to deploy apps on it.  What we&#8217;re going to create is a servlet and optionally, some classes to help us persist the incoming information to the app engine database.  If you&#8217;re using Eclipse with the Google App Engine plugin, then creating a project is simple.  On Eclipse simply click File-&gt;New-&gt;Project and then choose Web Application Project under the Google folder.  By default, a new project will be created with a servlet having the &#8220;doGet&#8221; method.  This method handles only HTTP GET requests.  You also need to create your own &#8220;doPost&#8221; method.  This is usually because stores including App World will POST the data to your URL.  What I do is just swap the doGet with doPost.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I then write my routines to handle the incoming request.  I usually capture all relevant information, extract some key parameters, use it to generate my activation key and provide a response.  For the sake of simplifying things.  Here is the code for my servlet that captures information from BlackBerry App World, generates the Activation Code and responds with that code:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If you paste the code above into your Eclipse, you will run into some errors.  These are the typical ones and how they can be fixed:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1. The KeyGen Class isn&#8217;t available.  This is my own KeyGen routine for generating Activation Keys.  It takes the BlackBerry PIN as an argument and does some magic on it.  You have to write this one yourself.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2. The Hex Class isn&#8217;t available.  In my case, I wanted to work with Hex strings and convert them back and forth.  I looked up the source to the Apache Commons Codec project and copied across the source code for the Hex class and all its dependencies into my own project.  You do not need to use it, but if you do, then I advise you to look at the Apache Commons Project.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3. The PMF class is missing.  This class is used if you want to Persist or store data. The PMF class source code is standard and Google App Engine has the sample code for it here.  If you need it, I&#8217;ve attached the code later on in this post.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">As far as I recall this is what you will need to address.  Now, lets move onto storing the incoming data on the database.  I store each request in a class called an Entry.  Thus, each POST request to my servlet will be checked and if it isn&#8217;t tagged as a test, then it will be stored to the database.  The Entry object is marked as persistable and this makes it easy to store in the App Engine datastore.  Here is the code for the Entry object:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Once you get this up and running, you have about the simplest mechanism for working with Dynamic Licensing with not only BlackBerry App World, but other stores as well.  You can, of course, make this as grandiose as you wish; that part is left as an exercise.  I&#8217;m just giving you a point to start at.</div>
<p>I started releasing commercial applications on BlackBerry App World and yesterday was the first time I used the Dynamic Licensing model.  I devised a solution based on Google App Engine and this post shows how this can be achieved and also includes sample source code for other developers in a similar situation.  Dynamic Licensing provides a mechanism for granting activation codes to user who purchase applications.  The system works like this:</p>
<div id="attachment_453" class="wp-caption alignnone" style="width: 490px"><a href="http://chirashi.zensay.com/wp-content/uploads/2009/12/appworldflow_sm.png"><img class="size-full wp-image-453" title="appworldflow_sm" src="http://chirashi.zensay.com/wp-content/uploads/2009/12/appworldflow_sm.png" alt="App World Flow" width="480" height="112" /></a><p class="wp-caption-text">App World Flow</p></div>
<p>As with almost all commercial, downloadable applications, online purchase and activation codes have become the norm.  The end-user pays for the product, downloads it and waits for an activation code to be sent to his email address.  Once he receives the code, he enters it into the app and he can begin using it.  This is straightforward if the developer sells the app on his own store that is hosted on his own server.  If he is to sell it on other stores, however, things become tricky.  Usually, well established stores like <a href="http://www.mobihand.com" target="_blank">MobiHand</a> and others have a mechanism that allows a developer to interface with their storefront for various purposes.  One of these instances is when activation codes are involved.  In cases like these, here is a quick run-down of how the purchase flow works:</p>
<ol>
<li>End-user visits Online Store</li>
<li>End-user buys app from the Online Store</li>
<li>Online Store contacts the Developer Server (using an HTTP POST request) with end-user specific details</li>
<li>Developer Server generates the activation key</li>
<li>Developer Server responds to the Online Store POST request with an activation key</li>
<li>Online Store then presents this activation key to the End-user</li>
</ol>
<p>It is the Developer&#8217;s responsibility to get his activation server up and running to ensure steps 3-5 are completed.  Sometimes this can be a painful task; especially after you&#8217;ve spent a few grueling weeks in developing your latest and greatest application.  My solution is to setup a free account on Google App Engine to host my activation server routines there.  Why bother you ask?  Here are some advantages that I can see:</p>
<ol>
<li>App Engine is free and can easily be converted to a paid model (reasonably priced) based only on usage of resources</li>
<li>App Engine offers Java so its more likely to be familiar to a BlackBerry developer</li>
<li>No administrative overhead with setting up a server or maintaining it</li>
<li>It&#8217;s cool if you like to get into &#8220;Cloud Computing&#8221;</li>
<li>It&#8217;s very easy to move off Google App Engine and onto your own server when you&#8217;re ready because of the standardized modules</li>
</ol>
<p>I&#8217;m not going to talk you through how to get an account, sign-up, etc.  Google has tons of docs and tutorials on how to do so.  I&#8217;ll assume you&#8217;ve already got your App Engine and know how to deploy apps on it.  What we&#8217;re going to create is a servlet and optionally, some classes to help us persist the incoming information to the app engine database.  If you&#8217;re using Eclipse with the Google App Engine plugin, then creating a project is simple.  On Eclipse simply click File-&gt;New-&gt;Project and then choose Web Application Project under the Google folder.  By default, a new project will be created with a servlet having the &#8220;doGet&#8221; method.  This method handles only HTTP GET requests.  You also need to create your own &#8220;doPost&#8221; method.  This is usually because stores including App World will POST the data to your URL.  What I do is just swap the doGet with doPost.</p>
<p>I then write my routines to handle the incoming request.  I usually capture all relevant information, extract some key parameters, use it to generate my activation key and provide a response.  For the sake of simplifying things.  Here is the code for my servlet that captures information from BlackBerry App World, generates the Activation Code and responds with that code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">net.zenconsult.keyserver</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jdo.PersistenceManager</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServlet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletResponse</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.zenconsult.codec.binary.Hex</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
@SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;serial&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> KeyServerServlet <span style="color: #000000; font-weight: bold;">extends</span> HttpServlet <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> doPost<span style="color: #009900;">&#40;</span>HttpServletRequest req, HttpServletResponse resp<span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// The RIM POST Format:</span>
		<span style="color: #666666; font-style: italic;">// PIN=12341234&amp;email=customeremail@email.com&amp;product=product&amp;version=1.2&amp;transactionid=123&amp;test=false</span>
&nbsp;
		<span style="color: #003399;">String</span> PIN <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PIN&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> email <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;email&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> product <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;product&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> version <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;version&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> transactionId <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;transactionid&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> test <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> verify <span style="color: #339933;">=</span> req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;verify&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Init vlaues</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>email <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>
			email <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>product <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>
			product <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>version <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>
			version <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>	
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>transactionId <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>
			transactionId <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>test <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>
			test <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// I realize using String.matches is taboo, but I did it anyway.  Feel free to change it</span>
		<span style="color: #666666; font-style: italic;">// Since you can also pass your own parameters, I am passing the &quot;verify&quot; parameter; security by obscurity, I know, </span>
		<span style="color: #666666; font-style: italic;">// but when using App Engine, your Servlet is publicly accessible, so...</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>PIN.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>p{XDigit}{8}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>verify <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>verify.<span style="color: #006633;">equalsIgnoreCase</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bbappworld&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// This is my own Key Generation Routine</span>
			KeyGen kg <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> KeyGen<span style="color: #009900;">&#40;</span>PIN<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span> hexString <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>Hex.<span style="color: #006633;">encodeHex</span><span style="color: #009900;">&#40;</span>kg.<span style="color: #006633;">genKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #003399;">String</span> <span style="color: #003399;">Key</span> <span style="color: #339933;">=</span> hexString.<span style="color: #006633;">toUpperCase</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;">if</span><span style="color: #009900;">&#40;</span>test.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;false&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				PersistenceManager pm <span style="color: #339933;">=</span> PMF.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getPersistenceManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				Entry entry <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Entry<span style="color: #009900;">&#40;</span>email, product, version, transactionId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				pm.<span style="color: #006633;">makePersistent</span><span style="color: #009900;">&#40;</span>entry<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				pm.<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>
			resp.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text/plain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			resp.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;key=&quot;</span><span style="color: #339933;">+</span><span style="color: #003399;">Key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If you paste the code above into your Eclipse, you will run into some errors.  These are the typical ones and how they can be fixed:</p>
<ol>
<li>The KeyGen Class isn&#8217;t available.  This is my own KeyGen routine for generating Activation Keys.  It takes the BlackBerry PIN as an argument and does some magic on it.  You have to write this one yourself.</li>
<li>The Hex Class isn&#8217;t available.  In my case, I wanted to work with Hex strings and convert them back and forth.  I looked up the source to the Apache Commons Codec project and copied across the source code for the Hex class and all its dependencies into my own project.  You do not need to use it, but if you do, then I advise you to look at the Apache Commons Project.</li>
<li>The PMF class is missing.  This class is used if you want to Persist or store data. The PMF class source code is standard and Google App Engine has the sample code for it <a href="http://code.google.com/appengine/docs/java/datastore/usingjdo.html" target="_blank">here</a>.  If you need it, I&#8217;ve attached the code later on in this post.</li>
</ol>
<p>As far as I recall this is what you will need to address.  Now, lets move onto storing the incoming data on the database.  I store each request in a class called an Entry.  Thus, each POST request to my servlet will be checked and if it isn&#8217;t tagged as a test, then it will be stored to the database.  The Entry object is marked as persistable and this makes it easy to store in the App Engine datastore.  Here is the code for the Entry object:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">net.zenconsult.keyserver</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jdo.annotations.IdGeneratorStrategy</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jdo.annotations.IdentityType</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jdo.annotations.PersistenceCapable</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jdo.annotations.Persistent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jdo.annotations.PrimaryKey</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.appengine.api.datastore.Key</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
@PersistenceCapable<span style="color: #009900;">&#40;</span>identityType <span style="color: #339933;">=</span> IdentityType.<span style="color: #006633;">APPLICATION</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Entry 
<span style="color: #009900;">&#123;</span>
	@PrimaryKey
    @Persistent<span style="color: #009900;">&#40;</span>valueStrategy <span style="color: #339933;">=</span> IdGeneratorStrategy.<span style="color: #006633;">IDENTITY</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Key</span> key<span style="color: #339933;">;</span>
&nbsp;
	@Persistent
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> email<span style="color: #339933;">;</span>
&nbsp;
	@Persistent
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> product<span style="color: #339933;">;</span>
&nbsp;
	@Persistent
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> version<span style="color: #339933;">;</span>
&nbsp;
	@Persistent
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> transactionId<span style="color: #339933;">;</span>
&nbsp;
	@Persistent
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Date</span> creationDate<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Entry<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> email, <span style="color: #003399;">String</span> product, <span style="color: #003399;">String</span> version, <span style="color: #003399;">String</span> transactionId<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		setEmail<span style="color: #009900;">&#40;</span>email<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setProduct<span style="color: #009900;">&#40;</span>product<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setVersion<span style="color: #009900;">&#40;</span>version<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setTransactionId<span style="color: #009900;">&#40;</span>transactionId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setCreationDate<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</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>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @param key the key to set
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setKey<span style="color: #009900;">&#40;</span><span style="color: #003399;">Key</span> key<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">key</span> <span style="color: #339933;">=</span> key<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @return the key
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Key</span> getKey<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> key<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @param email the email to set
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setEmail<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> email<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">email</span> <span style="color: #339933;">=</span> email<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @return the email
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getEmail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> email<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @param product the product to set
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setProduct<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> product<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">product</span> <span style="color: #339933;">=</span> product<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @return the product
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getProduct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> product<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @param version the version to set
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setVersion<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> version<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">version</span> <span style="color: #339933;">=</span> version<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @return the version
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getVersion<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> version<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @param transactionId the transactionId to set
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTransactionId<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> transactionId<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">transactionId</span> <span style="color: #339933;">=</span> transactionId<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @return the transactionId
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTransactionId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> transactionId<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @param creationDate the creationDate to set
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setCreationDate<span style="color: #009900;">&#40;</span><span style="color: #003399;">Date</span> creationDate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">creationDate</span> <span style="color: #339933;">=</span> creationDate<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * @return the creationDate
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Date</span> getCreationDate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> creationDate<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Once you get this up and running, you have about the simplest mechanism for working with Dynamic Licensing with not only BlackBerry App World, but other stores as well.  You can, of course, make this as grandiose as you wish; that part is left as an exercise.  I&#8217;m just giving you a point to start at.</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;title=App%20World%20Dynamic%20Licensing%20HOWTO&amp;bodytext=I%20started%20releasing%20commercial%20applications%20on%20BlackBerry%20App%20World%20and%20yesterday%20was%20the%20first%20time%20I%20used%20the%20Dynamic%20Licensing%20model.%20%C2%A0I%20devised%20a%20quick%20solution%20for%20working%20with%20Dynamic%20Licensing%20based%20on%20Google%20App%20Engine%20and%20this%20post%20shows%20ho" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;title=App%20World%20Dynamic%20Licensing%20HOWTO&amp;notes=I%20started%20releasing%20commercial%20applications%20on%20BlackBerry%20App%20World%20and%20yesterday%20was%20the%20first%20time%20I%20used%20the%20Dynamic%20Licensing%20model.%20%C2%A0I%20devised%20a%20quick%20solution%20for%20working%20with%20Dynamic%20Licensing%20based%20on%20Google%20App%20Engine%20and%20this%20post%20shows%20ho" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;t=App%20World%20Dynamic%20Licensing%20HOWTO" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;title=App%20World%20Dynamic%20Licensing%20HOWTO&amp;annotation=I%20started%20releasing%20commercial%20applications%20on%20BlackBerry%20App%20World%20and%20yesterday%20was%20the%20first%20time%20I%20used%20the%20Dynamic%20Licensing%20model.%20%C2%A0I%20devised%20a%20quick%20solution%20for%20working%20with%20Dynamic%20Licensing%20based%20on%20Google%20App%20Engine%20and%20this%20post%20shows%20ho" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;title=App%20World%20Dynamic%20Licensing%20HOWTO" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;title=App%20World%20Dynamic%20Licensing%20HOWTO" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F&amp;t=App%20World%20Dynamic%20Licensing%20HOWTO&amp;s=I%20started%20releasing%20commercial%20applications%20on%20BlackBerry%20App%20World%20and%20yesterday%20was%20the%20first%20time%20I%20used%20the%20Dynamic%20Licensing%20model.%20%C2%A0I%20devised%20a%20quick%20solution%20for%20working%20with%20Dynamic%20Licensing%20based%20on%20Google%20App%20Engine%20and%20this%20post%20shows%20ho" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=App%20World%20Dynamic%20Licensing%20HOWTO%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=App%20World%20Dynamic%20Licensing%20HOWTO&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Fapp-world-dynamic-licensing-howto%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/12/app-world-dynamic-licensing-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emulating the BlackBerry Phone Call Log Field</title>
		<link>http://chirashi.zensay.com/2009/12/emulating-the-blackberry-phone-call-log-field/</link>
		<comments>http://chirashi.zensay.com/2009/12/emulating-the-blackberry-phone-call-log-field/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 13:54:27 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jde]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=433</guid>
		<description><![CDATA[While writing an application for the BlackBerry, I wanted to emulate the layout of the Phone Log.  Typically, this looks like a set of rows laid out in a two-column or multi-column format.  Since there was no available field to achieve this, I had to write my own.  The way I did it was to [...]]]></description>
			<content:encoded><![CDATA[<p>While writing an application for the BlackBerry, I wanted to emulate the layout of the Phone Log.  Typically, this looks like a set of rows laid out in a two-column or multi-column format.  Since there was no available field to achieve this, I had to write my own.  The way I did it was to override the drawListRow method in an ObjectListField.  One thing you can notice in your BlackBerry call log screen is that the last 10 characters are always reserved and never appear as an ellipsis.  The last 10 characters are usually formatted thusly:</p>
<p><strong>[Call Attribute: upto 4 characters][Date or Time: upto 6 characters]</strong></p>
<p>Some examples of these are:</p>
<pre><code>
(W) 9:58p
(W2)11:22p
(H) 01/09
</code></pre>
<p>You will see in example 2 above, that all 10 characters are used up.  After I figured this out, the rest was pretty straightforward.  Here is the source code to my Field called PhoneNumberListField.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.rim.device.api.ui.DrawStyle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.rim.device.api.ui.Graphics</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.rim.device.api.ui.component.ListField</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.rim.device.api.ui.component.ObjectListField</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> PhoneNumberListField <span style="color: #000000; font-weight: bold;">extends</span> ObjectListField
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> PhoneNumberListField<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
     	    <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> PhoneNumberListField<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> style<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
     	    <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>style<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> drawListRow<span style="color: #009900;">&#40;</span>ListField listField, <span style="color: #003399;">Graphics</span> graphics,
        		<span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #000066; font-weight: bold;">int</span> y, <span style="color: #000066; font-weight: bold;">int</span> width<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
&nbsp;
        	<span style="color: #003399;">String</span> tmpCol1 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>listField, index<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        	<span style="color: #003399;">String</span> col1 <span style="color: #339933;">=</span> tmpCol1.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #009900;">&#40;</span>tmpCol1.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        	<span style="color: #003399;">String</span> col2 <span style="color: #339933;">=</span> tmpCol1.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>tmpCol1.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        	<span style="color: #000066; font-weight: bold;">int</span> col2Size <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getFont</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getAdvance</span><span style="color: #009900;">&#40;</span>col2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">int</span> col1Size <span style="color: #339933;">=</span> width <span style="color: #339933;">-</span> col2Size<span style="color: #339933;">;</span>
&nbsp;
        	<span style="color: #000066; font-weight: bold;">int</span> col1Start <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        	<span style="color: #000066; font-weight: bold;">int</span> col2Start <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>width <span style="color: #339933;">-</span> col2Size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        	graphics.<span style="color: #006633;">drawText</span><span style="color: #009900;">&#40;</span>col1, col1Start, y, DrawStyle.<span style="color: #006633;">ELLIPSIS</span>, col1Size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        	graphics.<span style="color: #006633;">drawText</span><span style="color: #009900;">&#40;</span>col2, col2Start, y, DrawStyle.<span style="color: #006633;">HDEFAULT</span>, col2Size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>How to implement</h3>
<p>You first create an array of Strings.  This array can contain phone numbers or a combination of First Name, Last Name together with the phone attribute like (W), (H) for Work and Home numbers respectively.  The last field will be the date or time.  I check the time of the call to see if it is older than 24 hours.  If it is, I use the date.  The format for the time is “<em>h:mma</em>” and for date it is “<em>MM/dd</em>”.  You can format these using SimpleDateFormat.</p>
<p>The full list of BlackBerry Attributes are represented as follows:</p>
<p>Home: (H)<br />
Work: (W)<br />
Mobile: (M)<br />
Pager: (P)<br />
Fax: (F)<br />
Other: (O)<br />
Work2: (W2)<br />
Home2: (H2)</p>
<p>The attribute constants can be found in the <a href="http://www.blackberry.com/developers/docs/4.6.0api/net/rim/blackberry/api/pdap/BlackBerryContact.html" target="_blank">BlackBerryContact Interface</a>.  A typical array of mine would look like this:</p>
<pre><code>
String[] numList = {“Sheran Gunasekera (W) 09/09”, “Scott Mosier (M) 9:39a”,
“Kevin Smith (M)10:39p”, “+12120031337     10:04p};</code></pre>
<p>Then, if I want to place this field on my MainScreen, I do this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">PhoneNumberListField numbers <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PhoneNumberListField<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
numbers.<span style="color: #006633;">setEmptyString</span><span style="color: #009900;">&#40;</span>“<span style="color: #339933;">***</span> No Calls Yet <span style="color: #339933;">***</span>”, DrawStyle.<span style="color: #006633;">HCENTER</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
numbers.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span>numList<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add<span style="color: #009900;">&#40;</span>numbers<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is what it looks like:</p>
<div id="attachment_444" class="wp-caption alignnone" style="width: 310px"><a href="http://chirashi.zensay.com/wp-content/uploads/2009/12/PhoneNumberListField.png"><img class="size-medium wp-image-444" title="PhoneNumberListField" src="http://chirashi.zensay.com/wp-content/uploads/2009/12/PhoneNumberListField-300x200.png" alt="PhoneNumberListField" width="300" height="200" /></a><p class="wp-caption-text">PhoneNumberListField</p></div>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;title=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field&amp;bodytext=While%20writing%20an%20application%20for%20the%20BlackBerry%2C%20I%20wanted%20to%20emulate%20the%20layout%20of%20the%20Phone%20Log.%C2%A0%20Typically%2C%20this%20looks%20like%20a%20set%20of%20rows%20laid%20out%20in%20a%20two-column%20or%20multi-column%20format.%C2%A0%20Since%20there%20was%20no%20available%20field%20to%20achieve%20this%2C%20I%20had%20" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;title=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field&amp;notes=While%20writing%20an%20application%20for%20the%20BlackBerry%2C%20I%20wanted%20to%20emulate%20the%20layout%20of%20the%20Phone%20Log.%C2%A0%20Typically%2C%20this%20looks%20like%20a%20set%20of%20rows%20laid%20out%20in%20a%20two-column%20or%20multi-column%20format.%C2%A0%20Since%20there%20was%20no%20available%20field%20to%20achieve%20this%2C%20I%20had%20" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;t=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;title=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field&amp;annotation=While%20writing%20an%20application%20for%20the%20BlackBerry%2C%20I%20wanted%20to%20emulate%20the%20layout%20of%20the%20Phone%20Log.%C2%A0%20Typically%2C%20this%20looks%20like%20a%20set%20of%20rows%20laid%20out%20in%20a%20two-column%20or%20multi-column%20format.%C2%A0%20Since%20there%20was%20no%20available%20field%20to%20achieve%20this%2C%20I%20had%20" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;title=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;title=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F&amp;t=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field&amp;s=While%20writing%20an%20application%20for%20the%20BlackBerry%2C%20I%20wanted%20to%20emulate%20the%20layout%20of%20the%20Phone%20Log.%C2%A0%20Typically%2C%20this%20looks%20like%20a%20set%20of%20rows%20laid%20out%20in%20a%20two-column%20or%20multi-column%20format.%C2%A0%20Since%20there%20was%20no%20available%20field%20to%20achieve%20this%2C%20I%20had%20" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Emulating%20the%20BlackBerry%20Phone%20Call%20Log%20Field&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F12%2Femulating-the-blackberry-phone-call-log-field%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/12/emulating-the-blackberry-phone-call-log-field/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing the JDE Plugin 5.0.0 for Eclipse</title>
		<link>http://chirashi.zensay.com/2009/11/installing-the-jde-plugin-5-0-0-for-eclipse/</link>
		<comments>http://chirashi.zensay.com/2009/11/installing-the-jde-plugin-5-0-0-for-eclipse/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 09:31:17 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[blackberry os 5.0.0]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jde]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=321</guid>
		<description><![CDATA[I wanted to try out the new Eclipse JDE plugin with OS 5.0.0 so I downloaded the ZIP file from the BlackBerry developer website and tried to install it on my Eclipse.
Towards the very end of the installation, I received some error messages.  They looked something like this:
An error occurred while collecting items to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-269" style="margin: 5px;" title="topleft" src="http://chirashi.zensay.com/wp-content/uploads/2009/10/topleft.gif" alt="topleft" width="139" height="55" />I wanted to try out the new Eclipse JDE plugin with OS 5.0.0 so I downloaded the ZIP file from the BlackBerry developer website and tried to install it on my Eclipse.</p>
<p>Towards the very end of the installation, I received some error messages.  They looked something like this:</p>
<pre>An error occurred while collecting items to be installed
  No repository found containing: net.rim.eide/osgi.bundle/1.0.0.67
  No repository found containing: net.rim.eide.bootstrapper/osgi.bundle/1.0.0.67
  No repository found containing: net.rim.eide.preprocessing.hook/osgi.bundle/1.0.0.67</pre>
<p>Quite annoying since it took me a long time to download the JDE ZIP file thanks to a slow Internet connection.  After a little bit of digging, I figured out that the three components I was missing were indeed not in the ZIP file that I had downloaded.  So rather than downloading the whole new ZIP file again, I thought I&#8217;d try another approach.</p>
<p>I went into the Eclipse Software Updates menu: <em>Help-&gt;Software Updates</em> and added the update site &#8220;http://www.blackberry.com/go/eclipseUpdate&#8221;.  I then refreshed the repository and looked for Plugin verison 5.0.0, highlighted the relevant checkboxes and clicked install.  Sure enough, Eclipse dutifully fetched the three missing bundles from RIM&#8217;s update site and finished off my installation.  I&#8217;m <a href="http://chirashi.zensay.com/2009/10/blackberry-os-5-0-0-knows-what-you-install/">playing with OS 5.0</a> as I write this.</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;title=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse&amp;bodytext=I%20wanted%20to%20try%20out%20the%20new%20Eclipse%20JDE%20plugin%20with%20OS%205.0.0%20so%20I%20downloaded%20the%20ZIP%20file%20from%20the%20BlackBerry%20developer%20website%20and%20tried%20to%20install%20it%20on%20my%20Eclipse.%0D%0A%0D%0ATowards%20the%20very%20end%20of%20the%20installation%2C%20I%20received%20some%20error%20messages.%20%20They%20" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;title=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse&amp;notes=I%20wanted%20to%20try%20out%20the%20new%20Eclipse%20JDE%20plugin%20with%20OS%205.0.0%20so%20I%20downloaded%20the%20ZIP%20file%20from%20the%20BlackBerry%20developer%20website%20and%20tried%20to%20install%20it%20on%20my%20Eclipse.%0D%0A%0D%0ATowards%20the%20very%20end%20of%20the%20installation%2C%20I%20received%20some%20error%20messages.%20%20They%20" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;t=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;title=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse&amp;annotation=I%20wanted%20to%20try%20out%20the%20new%20Eclipse%20JDE%20plugin%20with%20OS%205.0.0%20so%20I%20downloaded%20the%20ZIP%20file%20from%20the%20BlackBerry%20developer%20website%20and%20tried%20to%20install%20it%20on%20my%20Eclipse.%0D%0A%0D%0ATowards%20the%20very%20end%20of%20the%20installation%2C%20I%20received%20some%20error%20messages.%20%20They%20" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;title=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;title=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F&amp;t=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse&amp;s=I%20wanted%20to%20try%20out%20the%20new%20Eclipse%20JDE%20plugin%20with%20OS%205.0.0%20so%20I%20downloaded%20the%20ZIP%20file%20from%20the%20BlackBerry%20developer%20website%20and%20tried%20to%20install%20it%20on%20my%20Eclipse.%0D%0A%0D%0ATowards%20the%20very%20end%20of%20the%20installation%2C%20I%20received%20some%20error%20messages.%20%20They%20" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Installing%20the%20JDE%20Plugin%205.0.0%20for%20Eclipse&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F11%2Finstalling-the-jde-plugin-5-0-0-for-eclipse%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/11/installing-the-jde-plugin-5-0-0-for-eclipse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spyware removal howto guide</title>
		<link>http://chirashi.zensay.com/2009/07/spyware-removal-howto-guide/</link>
		<comments>http://chirashi.zensay.com/2009/07/spyware-removal-howto-guide/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 16:16:08 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=136</guid>
		<description><![CDATA[It occurred to me that I didn&#8217;t do a proper guide for the removal of the Etisalat spyware with my tool HiddenProgs.  I did a quick how-to. Get the Spyware Removal Guide.



Share this on:


	
	
	
	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>It occurred to me that I didn&#8217;t do a proper guide for the removal of the Etisalat spyware with my tool <a href="http://www.zensay.com/HiddenProgs.jad">HiddenProgs</a>.  I did a quick how-to. Get the <a href="http://chirashi.zensay.com/wp-content/uploads/2009/07/Spyware_Removal_Guide.pdf">Spyware Removal Guide</a>.</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;title=Spyware%20removal%20howto%20guide&amp;bodytext=It%20occurred%20to%20me%20that%20I%20didn%27t%20do%20a%20proper%20guide%20for%20the%20removal%20of%20the%20Etisalat%20spyware%20with%20my%20tool%20HiddenProgs.%C2%A0%20I%20did%20a%20quick%20how-to.%20Get%20the%20Spyware%20Removal%20Guide." title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;title=Spyware%20removal%20howto%20guide&amp;notes=It%20occurred%20to%20me%20that%20I%20didn%27t%20do%20a%20proper%20guide%20for%20the%20removal%20of%20the%20Etisalat%20spyware%20with%20my%20tool%20HiddenProgs.%C2%A0%20I%20did%20a%20quick%20how-to.%20Get%20the%20Spyware%20Removal%20Guide." title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;t=Spyware%20removal%20howto%20guide" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;title=Spyware%20removal%20howto%20guide&amp;annotation=It%20occurred%20to%20me%20that%20I%20didn%27t%20do%20a%20proper%20guide%20for%20the%20removal%20of%20the%20Etisalat%20spyware%20with%20my%20tool%20HiddenProgs.%C2%A0%20I%20did%20a%20quick%20how-to.%20Get%20the%20Spyware%20Removal%20Guide." title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;title=Spyware%20removal%20howto%20guide" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;title=Spyware%20removal%20howto%20guide" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F&amp;t=Spyware%20removal%20howto%20guide&amp;s=It%20occurred%20to%20me%20that%20I%20didn%27t%20do%20a%20proper%20guide%20for%20the%20removal%20of%20the%20Etisalat%20spyware%20with%20my%20tool%20HiddenProgs.%C2%A0%20I%20did%20a%20quick%20how-to.%20Get%20the%20Spyware%20Removal%20Guide." title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Spyware%20removal%20howto%20guide%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Spyware%20removal%20howto%20guide&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F07%2Fspyware-removal-howto-guide%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/07/spyware-removal-howto-guide/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sending messages to the Apache Error.log file when using Django</title>
		<link>http://chirashi.zensay.com/2009/05/sending-messages-to-the-apache-errorlog-file-when-using-django/</link>
		<comments>http://chirashi.zensay.com/2009/05/sending-messages-to-the-apache-errorlog-file-when-using-django/#comments</comments>
		<pubDate>Sun, 31 May 2009 08:27:57 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=23</guid>
		<description><![CDATA[Solves the problem of "sys.stdout access restricted by mod_wsgi"]]></description>
			<content:encoded><![CDATA[<p>I spent a considerable amount of time reading documentation that told me how to send errors to the Apache log filewhen you use mod_wsgi. I read documentation on how to integrate mod_wsgi with Apache and Django.  All of this was fine, but when I was trying to get it to work with my Django 1.0.2 installation and Apache2 running mod_wsgi, I was constantly greeted by lots of errors.  One in particular was &#8220;sys.stdout access restricted by mod_wsgi&#8221;.  The documents online didn&#8217;t help at all.</p>
<p>Finally, after looking into the django.core.handlers.wsgi module, I figured out how to send errors to the wsgi.errors setting and subsequently send errors to your Apache2 Error.log file.</p>
<p>I started off with my views.py as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">http</span> <span style="color: #ff7700;font-weight:bold;">import</span> HttpResponse
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">shortcuts</span> <span style="color: #ff7700;font-weight:bold;">import</span> render_to_response, get_object_or_404
<span style="color: #ff7700;font-weight:bold;">from</span> myapp.<span style="color: black;">models</span> <span style="color: #ff7700;font-weight:bold;">import</span> F
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> index<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
    c = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'myapp/index.html'</span>,c<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> detail<span style="color: black;">&#40;</span>request, name<span style="color: black;">&#41;</span>:
    n = F.<span style="color: black;">objects</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span>name=name<span style="color: black;">&#41;</span>
    c = <span style="color: black;">&#123;</span><span style="color: #483d8b;">'name'</span>: n.<span style="color: black;">fof</span><span style="color: black;">&#125;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'myapp/detail.html'</span>,c<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>If I needed to write to the Error.log file, I would have to change the code thusly:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">http</span> <span style="color: #ff7700;font-weight:bold;">import</span> HttpResponse
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">shortcuts</span> <span style="color: #ff7700;font-weight:bold;">import</span> render_to_response, get_object_or_404
<span style="color: #ff7700;font-weight:bold;">from</span> myapp.<span style="color: black;">models</span> <span style="color: #ff7700;font-weight:bold;">import</span> F
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> index<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
    c = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #66cc66;">&gt;&gt;</span> request.<span style="color: black;">environ</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'wsgi.errors'</span><span style="color: black;">&#93;</span>,<span style="color: #483d8b;">&quot;Teh Errorist!&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'myapp/index.html'</span>,c<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> detail<span style="color: black;">&#40;</span>request, name<span style="color: black;">&#41;</span>:
    n = F.<span style="color: black;">objects</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span>name=name<span style="color: black;">&#41;</span>
    c = <span style="color: black;">&#123;</span><span style="color: #483d8b;">'name'</span>: n.<span style="color: black;">fof</span><span style="color: black;">&#125;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'myapp/detail.html'</span>,c<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>The change is in line 7</p>
<p>I felt really stupid, because the solution was so straightforward.  I felt even more stupid that I couldn&#8217;t find any documentation out there.  Either way, I&#8217;m pleased that my app works, and in case someone else out there is searching for how to achieve this, then the above is how to do it.</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;title=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django&amp;bodytext=Solves%20the%20problem%20of%20%22sys.stdout%20access%20restricted%20by%20mod_wsgi%22" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;title=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django&amp;notes=Solves%20the%20problem%20of%20%22sys.stdout%20access%20restricted%20by%20mod_wsgi%22" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;t=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;title=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django&amp;annotation=Solves%20the%20problem%20of%20%22sys.stdout%20access%20restricted%20by%20mod_wsgi%22" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;title=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;title=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F&amp;t=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django&amp;s=Solves%20the%20problem%20of%20%22sys.stdout%20access%20restricted%20by%20mod_wsgi%22" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Sending%20messages%20to%20the%20Apache%20Error.log%20file%20when%20using%20Django&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2009%2F05%2Fsending-messages-to-the-apache-errorlog-file-when-using-django%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2009/05/sending-messages-to-the-apache-errorlog-file-when-using-django/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing CarvFS on Ubuntu 7.04</title>
		<link>http://chirashi.zensay.com/2007/06/installing-carvfs-on-ubuntu-704/</link>
		<comments>http://chirashi.zensay.com/2007/06/installing-carvfs-on-ubuntu-704/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 17:19:00 +0000</pubDate>
		<dc:creator>chopstick</dc:creator>
				<category><![CDATA[Forensics]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://chirashi.zensay.com/?p=4</guid>
		<description><![CDATA[In place carving can save you a fair amount of space.  There was a paper written about it and the Dutch National Police Agency also wrote a tool called CarvFS that does exactly this.  What CarvFS allows you to do is mount an EWF image or raw &#8216;dd&#8217; image and reference blocks of [...]]]></description>
			<content:encoded><![CDATA[<p>In place carving can save you a fair amount of space.  There was a paper written about it and the Dutch National Police Agency also wrote a tool called CarvFS that does exactly this.  What CarvFS allows you to do is mount an EWF image or raw <em>&#8216;dd&#8217;</em> image and reference blocks of data by using a specific directory listing format.  At it&#8217;s simplest level, you could run <em>&#8217;strings&#8217;</em> on a set of 1024 bytes beginning at the first byte by doing this:<br /><code><br /><span style="font-size:85%;">root@azazel:/mnt/carvfs/524a4efcaa84cf7391705b2b292644a6# strings CarvFS/0:1024.crv<br />NO NAME    FAT16<br />root@azazel:/mnt/carvfs/524a4efcaa84cf7391705b2b292644a6#</span><br /></code></p>
<p>I&#8217;ll leave you to work out why this is useful; alternatively you can also read my <a href="http://chirashi-security.blogspot.com/2007/07/memory-card-forensics.html">&#8220;Memory Card Forensics&#8221;</a> post.  Here is how I installed CarvFS:</p>
<p>Downloaded the source packages for <em>CarvFS, libcarvpath, libewf</em> and <em>fuse.</em>  They can be found here:</p>
<p><a href="http://downloads.sourceforge.net/ocfa/carvfs-0.2.1.tar.gz">CarvFS 0.2.1</a><br /><a href="http://downloads.sourceforge.net/ocfa/libcarvpath-0.1.4.tar.gz">libcarvpath 0.1.4</a><br /><a href="https://www.uitwisselplatform.nl/frs/download.php/192/libewf-beta-20061223.tar.gz">libewf-beta-20061223</a><br /><a href="http://downloads.sourceforge.net/fuse/fuse-2.6.5.tar.gz">fuse 2.6.5</a></p>
<p>There&#8217;s no specific order, but make sure that libewf, fuse and libcarvpath are installed before CarvFS.</p>
<p>I believe <em>fuse</em> should already be running as a kernel module in 7.04, so the kernel module will not be built.</p>
<p>Then, once you install CarvFS, you&#8217;re pretty much ready to go.  I had one problem when I ran <em>carvfs</em> I received a library not found error for <em>libfuse.so.2</em>.  The library itself was in <em>/usr/local/lib</em>, but there was no entry in <em>/etc/ld.so.conf</em>.  So I added the entry and ran <em>ldconfig</em> and all was well.</p>
<p>How will you test CarvFS? First, you will need either a raw <em>&#8216;dd&#8217;</em> image or an EWF image.  <em>libewf</em> will install a tool called <em>&#8216;ewfacquire&#8217;</em> which you can use to make EWF images.  Here is an excerpt of one of my sessions:</p>
<p><code><br /><span style="font-size:85%;">sheran@azazel:~/Personal/research$ ewfacquire /dev/sdb1<br />ewfacquire 20061223 (libewf 20061223, zlib 1.2.3, libcrypto 0.9.8)<br />Information about acquiry required, please provide the necessary input<br />Image path and filename without extension: usbdisk<br />Case number: 1923<br />Description: USB Disk<br />Evidence number: 12<br />Examiner name: Sheran<br />Notes: 64Mb USB Disk used for Forensics tests<br />Media type (fixed, removable) [fixed]: removable<br />Use compression (none, fast, best) [none]: best<br />Use EWF file format (smart, ftk, encase1, encase2, encase3, encase4, encase5, linen5, ewfx) [encase5]:<br />Start to acquire at offset (0 >= value >= 65135616) [0]:<br />Amount of bytes to acquire (0 >= value >= 65135616) [65135616]:<br />Evidence segment file size in kbytes (2^10) (1440 >= value >= 2097152) [665600]:<br />The amount of sectors to read at once (64, 128, 256, 512, 1024, 2048, 4096) [64]: 512<br />The amount of sectors to be used as error granularity (1 >= value >= 512) [64]:<br />The amount of retries when a read error occurs (0 >= value >= 255) [2]:<br />Wipe sectors on read error (mimic EnCase like behavior) (yes, no) [yes]:<br />...<br />...<br />...<br />...</span><br /></code><br />It goes on to acquire an EWF image of my 64Mb USB Disk.</p>
<p>The next step would be to mount it.  Create a mount point for it first.  I use <em>/mnt/carvfs</em>.</p>
<p><code><br /><span style="font-size:85%;">sheran@azazel:~/Personal/research$ sudo carvfs /mnt/carvfs ewf usbdisk.E01 /mnt/carvfs/fad545a8c4c86973eb0ae33da06e9c80<br />sheran@azazel:~/Personal/research$</span><br /></code></p>
<p>Now that the image is mounted, switch to the root prompt (I wasted some time on this one) and then go into the mounted image:</p>
<p><code><br /><span style="font-size:85%;">root@azazel:/mnt/carvfs/fad545a8c4c86973eb0ae33da06e9c80# ls -alrt<br />total 63617<br />-rw-rw-rw- 1 root root     2545 1970-01-01 04:00 README<br />-r--r--r-- 1 root root     1397 1970-01-01 04:00 ocfa.xml<br />-r--r--r-- 1 root root 65135616 1970-01-01 04:00 CarvFS.crv<br />d--x--x--x 3 root root        0 1970-01-01 04:00 CarvFS<br />drwxr-xr-x 3 root root        0 1970-01-01 04:00 .<br />drwxr-xr-x 5 root root     4096 2007-06-18 17:43 ..</span><br /></code><br />I then ran a strings on the first 512 bytes like so:<br /><code><br /><span style="font-size:85%;">root@azazel:/mnt/carvfs/fad545a8c4c86973eb0ae33da06e9c80# strings CarvFS/0:512.crv<br />MSDOS5.0<br />NO NAME    FAT32   3<br />f`f;F<br />fXfXfXfX<br />NTLDR<br />Remove disks or other media.<br />Disk error<br />Press any key to restart<br />root@azazel:/mnt/carvfs/fad545a8c4c86973eb0ae33da06e9c80#</span><br /></code><br />That&#8217;s about it.</p>
<p>I know my instructions probably suck big time, but I didn&#8217;t want to waste too much time in actually telling you how to do some of the other things.  Anyway, if you&#8217;re sniffing around CarvFS you probably know how to do most of the stuff anyway.  If, however, you still want to know stepwise details, drop me a comment or mail me.</p>
<p>Till then.</p>



Share this on:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;title=Installing%20CarvFS%20on%20Ubuntu%207.04&amp;bodytext=In%20place%20carving%20can%20save%20you%20a%20fair%20amount%20of%20space.%20%20There%20was%20a%20paper%20written%20about%20it%20and%20the%20Dutch%20National%20Police%20Agency%20also%20wrote%20a%20tool%20called%20CarvFS%20that%20does%20exactly%20this.%20%20What%20CarvFS%20allows%20you%20to%20do%20is%20mount%20an%20EWF%20image%20or%20raw%20%27dd%27%20ima" title="Digg"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;title=Installing%20CarvFS%20on%20Ubuntu%207.04&amp;notes=In%20place%20carving%20can%20save%20you%20a%20fair%20amount%20of%20space.%20%20There%20was%20a%20paper%20written%20about%20it%20and%20the%20Dutch%20National%20Police%20Agency%20also%20wrote%20a%20tool%20called%20CarvFS%20that%20does%20exactly%20this.%20%20What%20CarvFS%20allows%20you%20to%20do%20is%20mount%20an%20EWF%20image%20or%20raw%20%27dd%27%20ima" title="del.icio.us"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;t=Installing%20CarvFS%20on%20Ubuntu%207.04" title="Facebook"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;title=Installing%20CarvFS%20on%20Ubuntu%207.04&amp;annotation=In%20place%20carving%20can%20save%20you%20a%20fair%20amount%20of%20space.%20%20There%20was%20a%20paper%20written%20about%20it%20and%20the%20Dutch%20National%20Police%20Agency%20also%20wrote%20a%20tool%20called%20CarvFS%20that%20does%20exactly%20this.%20%20What%20CarvFS%20allows%20you%20to%20do%20is%20mount%20an%20EWF%20image%20or%20raw%20%27dd%27%20ima" title="Google Bookmarks"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;title=Installing%20CarvFS%20on%20Ubuntu%207.04" title="Reddit"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;title=Installing%20CarvFS%20on%20Ubuntu%207.04" title="StumbleUpon"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F&amp;t=Installing%20CarvFS%20on%20Ubuntu%207.04&amp;s=In%20place%20carving%20can%20save%20you%20a%20fair%20amount%20of%20space.%20%20There%20was%20a%20paper%20written%20about%20it%20and%20the%20Dutch%20National%20Police%20Agency%20also%20wrote%20a%20tool%20called%20CarvFS%20that%20does%20exactly%20this.%20%20What%20CarvFS%20allows%20you%20to%20do%20is%20mount%20an%20EWF%20image%20or%20raw%20%27dd%27%20ima" title="Tumblr"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Installing%20CarvFS%20on%20Ubuntu%207.04%20-%20http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F" title="Twitter"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Installing%20CarvFS%20on%20Ubuntu%207.04&amp;url=http%3A%2F%2Fchirashi.zensay.com%2F2007%2F06%2Finstalling-carvfs-on-ubuntu-704%2F" title="Slashdot"><img src="http://chirashi.zensay.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://chirashi.zensay.com/2007/06/installing-carvfs-on-ubuntu-704/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
