<?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"
	>

<channel>
	<title>Just answer the F*#king question &#187; Uncategorized</title>
	<atom:link href="http://www.jatfq.com/archives/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jatfq.com</link>
	<description>Saving the world from dicks with forum logins ...</description>
	<pubDate>Mon, 03 Nov 2008 17:18:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Serve JAD files OTA with PHP</title>
		<link>http://www.jatfq.com/archives/62</link>
		<comments>http://www.jatfq.com/archives/62#comments</comments>
		<pubDate>Mon, 03 Nov 2008 17:14:41 +0000</pubDate>
		<dc:creator>Sime</dc:creator>
		
		<category><![CDATA[J2ME]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jatfq.com/?p=62</guid>
		<description><![CDATA[Some handy code to dynamtically serve JAD files for OTA installation. The below script sets the appropriate headers types, also tidies up the JAD file removing stray characters which can cause issues and setting the correct file paths internally.
Place the PH script in a root directory as serveJAD.php. Place your JAR and JAD files in [...]]]></description>
			<content:encoded><![CDATA[<p>Some handy code to dynamtically serve JAD files for OTA installation. The below script sets the appropriate headers types, also tidies up the JAD file removing stray characters which can cause issues and setting the correct file paths internally.</p>
<p>Place the PH script in a root directory as serveJAD.php. Place your JAR and JAD files in a subdirectory /J2ME</p>
<p>Call the script by serveJAD.php?format=J2ME&#038;file={jad minus extension} or you can use the Apache rewrite below and call as /J2ME/file.jad</p>
<p>ie</p>
<p>serveJAD.php?format=J2ME&#038;file=game</p>
<p>or with Apache rewrite </p>
<p>/J2ME/game.jad</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
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?</span>
	<span style="color: #0000ff;">$format</span>   = <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;format&quot;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #0000ff;">$file</span>     = <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;.jad&quot;</span>;
    <span style="color: #000066;">header</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Cache-Control: no-cache, must-revalidate,no-transform&quot;</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000066;">header</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Pragma: no-cache&quot;</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066;">header</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-type: text/vnd.sun.j2me.app-descriptor&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066;">header</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Disposition: attachment; filename=&quot;</span>.<span style="color: #0000ff;">$file</span>.<span style="color: #ff0000;">&quot;;&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$jad</span> = <span style="color: #000066;">file_get_contents</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;./&quot;</span>.<span style="color: #0000ff;">$format</span>.<span style="color: #ff0000;">&quot;/&quot;</span>.<span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$lines</span> = <span style="color: #000066;">explode</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>,<span style="color: #0000ff;">$jad</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$final</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
	<span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$lines</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$line</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #0000ff;">$line</span> = <span style="color: #000066;">trim</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$line</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">strlen</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$line</span><span style="color: #66cc66;">&#41;</span>&gt;<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #0000ff;">$keypair</span> = <span style="color: #000066;">explode</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;: &quot;</span>,<span style="color: #0000ff;">$line</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>==<span style="color: #ff0000;">'MIDlet-Jar-URL'</span> || <span style="color: #000066;">stristr</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>,<span style="color: #ff0000;">&quot;RIM-COD-URL&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				<span style="color: #0000ff;">$url</span> = <span style="color: #000066;">trim</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #000066;">stristr</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span>,<span style="color: #ff0000;">&quot;http:&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
					<span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;http://&quot;</span>.<span style="color: #0000ff;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;HTTP_HOST&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;/$format/&quot;</span>.<span style="color: #0000ff;">$url</span>;
				<span style="color: #66cc66;">&#125;</span>
			<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>==<span style="color: #ff0000;">'MIDlet-Jar-Size'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				<span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> =  <span style="color: #000066;">filesize</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;./&quot;</span>.<span style="color: #0000ff;">$format</span>.<span style="color: #ff0000;">&quot;/&quot;</span>.<span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;.jar&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0000ff;">$line</span> = <span style="color: #000066;">join</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;: &quot;</span>,<span style="color: #0000ff;">$keypair</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0000ff;">$l</span> = <span style="color: #000066;">trim</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$line</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #000066;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$final</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #0000ff;">$final</span>.=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
			<span style="color: #0000ff;">$final</span>.=<span style="color: #0000ff;">$l</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000066;">print</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$final</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><code><br />
    RewriteEngine On<br />
    RewriteRule /J2ME/(.*)\.jad /serveJAD.php?format=J2ME&#038;file=$1<br />
</code></p>
<p>You can also use this to build automatic index pages, using this as dir.php?format=J2ME</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
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #0000ff;">$format</span>   = <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;format&quot;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #0000ff;">$scanthis</span> = <span style="color: #ff0000;">&quot;./&quot;</span>.<span style="color: #0000ff;">$format</span>;
 	<span style="color: #0000ff;">$scanlisting</span> = scandir<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$scanthis</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$dirlisting</span> = <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$scanlisting</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span> =&gt; <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">stristr</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$value</span>,<span style="color: #ff0000;">&quot;jad&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #0000ff;">$name</span> = <span style="color: #000066;">explode</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;.&quot;</span>,<span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0000ff;">$dirlisting</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000066;">ksort</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dirlisting</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span>&gt;
&lt;html xmlns=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span>&gt;
&lt;head&gt;
&lt;link href=<span style="color: #ff0000;">&quot;apps.css&quot;</span> rel=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> type=<span style="color: #ff0000;">&quot;text/css&quot;</span> /&gt;
&lt;meta http-equiv=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> content=<span style="color: #ff0000;">&quot;text/html; charset=iso-8859-1&quot;</span> /&gt;
&lt;title&gt;Application listing&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dirlisting</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;a href=<span style="color: #ff0000;">&quot;/&lt;?php print($format);?&gt;/&lt;?php print($name);?&gt;.jad&quot;</span>&gt;&lt;?php <span style="color: #000066;">print</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span>;?&gt;&lt;/a&gt;&lt;br /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #66cc66;">&#125;</span>
?&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>


<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://del.icio.us/favicon.ico" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F62&amp;title=Serve+JAD+files+OTA+with+PHP" title="Stumble it!"><img src="/icon_stumbleupon.gif" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.jatfq.com/archives/62/feed</wfw:commentRss>
		</item>
		<item>
		<title>Jerky video / flash on laptops.</title>
		<link>http://www.jatfq.com/archives/53</link>
		<comments>http://www.jatfq.com/archives/53#comments</comments>
		<pubDate>Thu, 10 Jul 2008 01:01:41 +0000</pubDate>
		<dc:creator>Sime</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jatfq.com/archives/53</guid>
		<description><![CDATA[Ok, this one took me ages to work out. Acer laptop had been running fine for ages, then suddenly any video playback would be jerky after about 2 or 3 minutes, along with Flash applications going slow. Youtube unwatchable, Quicktime very patchy and intermittent.
No spyware, no virus, no random processes. Drivers all up to date, [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, this one took me ages to work out. Acer laptop had been running fine for ages, then suddenly any video playback would be jerky after about 2 or 3 minutes, along with Flash applications going slow. Youtube unwatchable, Quicktime very patchy and intermittent.</p>
<p>No spyware, no virus, no random processes. Drivers all up to date, firmware up to date.</p>
<p>After much hunting, reinstalls, spyware checking etc the simple answer turned out to be the laptop was overheating. So ( and this is specific to my Acer, but look for a similar software solution on other providers ), I turned down the speed of my ATI graphics processor from the Cataylst Control Center, and bam!, back up working fine ( look under Power Play, set the setting for &#8216;Plugged In&#8217; as optimal battery ). For day to day use ( no large 3D applications ) works the same as maximum performance.</p>
<p>Also, give the fan a clean with a compressed air duster. The Acer only has a single fan hole under the chassis, and can get very dust filled. Clogged vent, no airflow, high temperature.</p>
<p>Some handy tools to check whats going on:</p>
<p><a href="http://www.almico.com/speedfan.php">Speed Fan</a>, gives you current temperatures of your various chips. With the Acer, if the core is getting above 70, you will possibly start having issues.  You can also use the EpowerManagement to lower the core CPU speed ( and thus temperature ), however, be aware of display issues with multiple users.</p>
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">Process Explorer</a>, an advanced Windows Task Manager. Even better, it shows DPCs ( Deferred procedure calls ) - why? Well, too many of these and something is wrong somewhere between your software and hardware, and overheating CAN cause these issues. You will always have SOME, just run the video or flash, and if it really increases when the video start to go bad and you may have heat problems.</p>
<p>Anyway, this not may be THE solution, but not all performance issues are software, virus or spyware related.</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops." title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops." title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops." title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops." title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops.', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://del.icio.us/favicon.ico" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops." title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F53&amp;title=Jerky+video+%2F+flash+on+laptops." title="Stumble it!"><img src="/icon_stumbleupon.gif" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.jatfq.com/archives/53/feed</wfw:commentRss>
		</item>
		<item>
		<title>Acer EPowerManagement Issues</title>
		<link>http://www.jatfq.com/archives/52</link>
		<comments>http://www.jatfq.com/archives/52#comments</comments>
		<pubDate>Thu, 10 Jul 2008 00:49:09 +0000</pubDate>
		<dc:creator>Sime</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jatfq.com/archives/52</guid>
		<description><![CDATA[So, you can&#8217;t get your Acer laptop to keep a nice bright display. You set it nice and bright, then a few seconds later it goes dim again. You change the profile in EPowerManagement, goes bright then dark again. Doesn&#8217;t seem to happen all the time. Hair pulling time.
Unfortunatley, your looking at an issue with [...]]]></description>
			<content:encoded><![CDATA[<p>So, you can&#8217;t get your Acer laptop to keep a nice bright display. You set it nice and bright, then a few seconds later it goes dim again. You change the profile in EPowerManagement, goes bright then dark again. Doesn&#8217;t seem to happen all the time. Hair pulling time.</p>
<p>Unfortunatley, your looking at an issue with the EPowerManagement software, and probably the issue is when another user is logged on to the laptop at the same time. The solution &#8230; err .. sorry, there is none. You just have to uninstall the EPowermanagement option from Add / Remove programs. In all honestly, not a major loss.</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://del.icio.us/favicon.ico" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F52&amp;title=Acer+EPowerManagement+Issues" title="Stumble it!"><img src="/icon_stumbleupon.gif" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.jatfq.com/archives/52/feed</wfw:commentRss>
		</item>
		<item>
		<title>Converting a Midlet to a COD file for OTA installation</title>
		<link>http://www.jatfq.com/archives/20</link>
		<comments>http://www.jatfq.com/archives/20#comments</comments>
		<pubDate>Thu, 14 Feb 2008 15:01:19 +0000</pubDate>
		<dc:creator>Sime</dc:creator>
		
		<category><![CDATA[RIM / Blackberry]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jatfq.com/archives/20</guid>
		<description><![CDATA[God, RIM sucks. Thought I&#8217;d mention that. I hate Blackberries with passion. Really.
Now, if you are converting a Midlet to a COD file, you will need to use the infamous rapc tool provided with the RIM JDE ( in the bin directory if you are looking for it ) . Now, along with issues with [...]]]></description>
			<content:encoded><![CDATA[<p>God, RIM sucks. Thought I&#8217;d mention that. I hate Blackberries with passion. Really.</p>
<p>Now, if you are converting a Midlet to a COD file, you will need to use the infamous rapc tool provided with the RIM JDE ( in the bin directory if you are looking for it ) . Now, along with issues with multiple versions, bugs and what have you, one big pain is if you want the RIM version of the JAD file created for OTA installation, rapc doesn&#8217;t give you all the parameters if you use the -midlet paramater. If you DON&#8217;T use it, you get a nice JAD but the COD will not work.</p>
<p>So, to get around this, I created a small app to extract the RIM specfic information from the COD file generated by rapc.</p>
<p>Generated the COD using</p>
<p><code>rapc import="%jde%\lib\net_rim_api.jar" codename=%jar% -midlet jad=%jar%.jad %jar%.jar </code></p>
<p>where %jde% is your JDE path, %jar% is the name of your module.</p>
<p><a href='http://www.jatfq.com/wp-content/uploads/2008/02/cod2jad.jar' title='Extract JAD information from a COD file'>Extract JAD information from a COD file</a></p>
<p>To run:</p>
<p><code>java -jar cod2jad.jar {cod file} {module name}</code></p>
<p>This will dump the extra information to stdout, so you can just append it to your JAD file with >>, ie</p>
<p><code>java -jar cod2jad.jar path.cod myapp >> path.jad</code></p>
<p>Remember, once you have done this, open the COD file in winzip ( or whatever ) and extract the seperate elements to your webserver. Once note, if you COD is only made of one module, this will probably fail ( sorry ).</p>
<p>Oh, and if you are using Netbeans components, and/or getting verification errors, try turning down your obfusication level in your project - rapc hates the splash screen and wait screen when obfusicated for some reason.  The other option is to try including the net_rim_api.jar in your project ( but don&#8217;t include in the package ).</p>
<p>And even nicer of me, here is the source 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
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
132
133
134
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">package</span> com.<span style="color: #006600;">magnetmobile</span>.<span style="color: #006600;">tools</span>.<span style="color: #006600;">rim</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 *
 * @author Sime when drunk ... yay drunk code
 */</span>
<span style="color: #a1a100;">import java.io.*;</span>
<span style="color: #a1a100;">import java.util.*;</span>
<span style="color: #a1a100;">import java.util.jar.*;</span>
<span style="color: #a1a100;">import java.io.UnsupportedEncodingException;</span>
<span style="color: #a1a100;">import java.security.MessageDigest;</span>
<span style="color: #a1a100;">import java.security.NoSuchAlgorithmException;</span>
<span style="color: #a1a100;">import java.util.logging.Level;</span>
<span style="color: #a1a100;">import java.util.logging.Logger;</span>
<span style="color: #a1a100;">import java.util.zip.ZipEntry;</span>
<span style="color: #a1a100;">import java.util.zip.ZipInputStream;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Cod2Jad <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span> args<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #aaaadd; font-weight: bold;">NoSuchAlgorithmException</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #aaaadd; font-weight: bold;">FileInputStream</span> fis = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #993333;">int</span> count = <span style="color: #cc66cc;">0</span>;
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>args.<span style="color: #006600;">length</span> != <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;usage: {path to COD} {Module name}&quot;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">exit</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #aaaadd; font-weight: bold;">Hashtable</span> htSizes = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">Hashtable</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #aaaadd; font-weight: bold;">Hashtable</span> htJarContents = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">Hashtable</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            fis = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">FileInputStream</span><span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
            <span style="color: #aaaadd; font-weight: bold;">BufferedInputStream</span> bis = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">BufferedInputStream</span><span style="color: #66cc66;">&#40;</span>fis<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #aaaadd; font-weight: bold;">ZipInputStream</span> zis = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">ZipInputStream</span><span style="color: #66cc66;">&#40;</span>bis<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #aaaadd; font-weight: bold;">ZipEntry</span> ze = <span style="color: #000000; font-weight: bold;">null</span>;
            <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ze = zis.<span style="color: #006600;">getNextEntry</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ze.<span style="color: #006600;">isDirectory</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #000000; font-weight: bold;">continue</span>;
                <span style="color: #66cc66;">&#125;</span>
&nbsp;
                <span style="color: #993333;">int</span> size = <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span><span style="color: #66cc66;">&#41;</span> ze.<span style="color: #006600;">getSize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #808080; font-style: italic;">// -1 means unknown size.</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>size == <span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    size = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">Integer</span><span style="color: #66cc66;">&#41;</span> htSizes.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>ze.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">intValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
                <span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> b = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span><span style="color: #66cc66;">&#41;</span> size<span style="color: #66cc66;">&#93;</span>;
                <span style="color: #993333;">int</span> rb = <span style="color: #cc66cc;">0</span>;
                <span style="color: #993333;">int</span> chunk = <span style="color: #cc66cc;">0</span>;
                <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span><span style="color: #66cc66;">&#41;</span> size - rb<span style="color: #66cc66;">&#41;</span> &gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    chunk = zis.<span style="color: #006600;">read</span><span style="color: #66cc66;">&#40;</span>b, rb, <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span><span style="color: #66cc66;">&#41;</span> size - rb<span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>chunk == <span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #000000; font-weight: bold;">break</span>;
                    <span style="color: #66cc66;">&#125;</span>
                    rb += chunk;
                <span style="color: #66cc66;">&#125;</span>
                htJarContents.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>ze.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, b<span style="color: #66cc66;">&#41;</span>;
                process<span style="color: #66cc66;">&#40;</span>ze, count, b<span style="color: #66cc66;">&#41;</span>;
                count++;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;RIM-COD-Module-Name:&quot;</span> + args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;RIM-COD-Module-Dependencies: net_rim_cldc&quot;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;RIM-COD-Creation-Time: 1202924527&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            zis.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            bis.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            fis.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">IOException</span> ex<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Could not access file &quot;</span>+args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">exit</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
                fis.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">IOException</span> ex<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                Logger.<span style="color: #006600;">getLogger</span><span style="color: #66cc66;">&#40;</span>Cod2Jad.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">log</span><span style="color: #66cc66;">&#40;</span>Level.<span style="color: #006600;">SEVERE</span>, <span style="color: #000000; font-weight: bold;">null</span>, ex<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> process<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">Object</span> obj, <span style="color: #993333;">int</span> count,<span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> data<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #aaaadd; font-weight: bold;">NoSuchAlgorithmException</span>,
<span style="color: #aaaadd; font-weight: bold;">UnsupportedEncodingException</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #aaaadd; font-weight: bold;">ZipEntry</span> entry = <span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">ZipEntry</span><span style="color: #66cc66;">&#41;</span> obj;
        <span style="color: #aaaadd; font-weight: bold;">String</span> name = entry.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #993333;">long</span> size = entry.<span style="color: #006600;">getSize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #993333;">long</span> compressedSize = entry.<span style="color: #006600;">getCompressedSize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #aaaadd; font-weight: bold;">String</span> output = <span style="color: #ff0000;">&quot;RIM-COD-URL&quot;</span> + <span style="color: #66cc66;">&#40;</span>count &gt; <span style="color: #cc66cc;">0</span> ? <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;-&quot;</span> + count<span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;: &quot;</span> + name;
        <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>output<span style="color: #66cc66;">&#41;</span>;
&nbsp;
        output = <span style="color: #ff0000;">&quot;RIM-COD-Size&quot;</span> + <span style="color: #66cc66;">&#40;</span>count &gt; <span style="color: #cc66cc;">0</span> ? <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;-&quot;</span> + count<span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;: &quot;</span> + compressedSize;
        <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>output<span style="color: #66cc66;">&#41;</span>;
&nbsp;
        output = <span style="color: #ff0000;">&quot;RIM-COD-SHA1&quot;</span> + <span style="color: #66cc66;">&#40;</span>count &gt; <span style="color: #cc66cc;">0</span> ? <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;-&quot;</span> + count<span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;: &quot;</span>;
        output +=  SHA1<span style="color: #66cc66;">&#40;</span>data, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>output<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #aaaadd; font-weight: bold;">String</span> convertToHex<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> data, <span style="color: #993333;">boolean</span> spaced<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #aaaadd; font-weight: bold;">StringBuffer</span> buf = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">StringBuffer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &lt;
                data.<span style="color: #006600;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #993333;">int</span> halfbyte = <span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> &gt;&gt;&gt; <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> &amp; 0x0F;
            <span style="color: #993333;">int</span> two_halfs = <span style="color: #cc66cc;">0</span>;
            <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span> &lt;= halfbyte<span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span>halfbyte &lt;= <span style="color: #cc66cc;">9</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    buf.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">char</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'0'</span> + halfbyte<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                    buf.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">char</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'a'</span> + <span style="color: #66cc66;">&#40;</span>halfbyte - <span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
&nbsp;
                halfbyte = data<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> &amp; 0x0F;
            <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>two_halfs++ &lt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>spaced<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                buf.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' '</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> buf.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #aaaadd; font-weight: bold;">String</span> SHA1<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> data, <span style="color: #993333;">boolean</span> spaced<span style="color: #66cc66;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #aaaadd; font-weight: bold;">NoSuchAlgorithmException</span>, <span style="color: #aaaadd; font-weight: bold;">UnsupportedEncodingException</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #aaaadd; font-weight: bold;">MessageDigest</span> md;
        md =
                <span style="color: #aaaadd; font-weight: bold;">MessageDigest</span>.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SHA-1&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> sha1hash = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">byte</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#93;</span>;
        md.<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span>data, <span style="color: #cc66cc;">0</span>, data.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>;
        sha1hash =
                md.<span style="color: #006600;">digest</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #000000; font-weight: bold;">return</span> convertToHex<span style="color: #66cc66;">&#40;</span>sha1hash, spaced<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>


<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://del.icio.us/favicon.ico" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F20&amp;title=Converting+a+Midlet+to+a+COD+file+for+OTA+installation" title="Stumble it!"><img src="/icon_stumbleupon.gif" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.jatfq.com/archives/20/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
