<?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>Inspirated &#187; Inbox Stats</title>
	<atom:link href="http://inspirated.com/tag/inbox-stats/feed" rel="self" type="application/rss+xml" />
	<link>http://inspirated.com</link>
	<description>krkhan&#039;s blog</description>
	<lastBuildDate>Thu, 05 Apr 2012 16:19:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Inbox Stats v1.1 &#8212; S60 3rd Edition Compatibility</title>
		<link>http://inspirated.com/2010/02/06/inbox-stats-v1-1-s60-3rd-edition-compatibility</link>
		<comments>http://inspirated.com/2010/02/06/inbox-stats-v1-1-s60-3rd-edition-compatibility#comments</comments>
		<pubDate>Sat, 06 Feb 2010 10:16:50 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Inbox]]></category>
		<category><![CDATA[Inbox Stats]]></category>
		<category><![CDATA[Nokia]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PyS60]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Series 60]]></category>
		<category><![CDATA[SMS]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Symbian]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://inspirated.com/?p=261</guid>
		<description><![CDATA[Continuing the migration to E71, here&#8217;s the new release for Inbox Stats which works on Python 2.5 releases: inboxstats-1.1.zip Permalink &#124; One comment Post tags: Code, Graphics, Inbox, Inbox Stats, Nokia, Open Source, PyS60, Python, Series 60, SMS, Statistics, Symbian, Technology]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Continuing the migration to E71, here&#8217;s the new release for <a href="http://code.inspirated.com/pys60/inbox-stats/">Inbox Stats</a> which works on Python 2.5 releases:</p>
<p style="text-align: center"><a href="http://inspirated.com/uploads/inboxstats-1.1.zip">inboxstats-1.1.zip</a><br />
<img src="http://inspirated.com/uploads/inboxstats-1.1.jpg" alt="Inbox Stats v1.1 Screenshot" /></p>
<div class="shr-publisher-261"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2010/02/06/inbox-stats-v1-1-s60-3rd-edition-compatibility">Permalink</a> |
<a href="http://inspirated.com/2010/02/06/inbox-stats-v1-1-s60-3rd-edition-compatibility#comments">One comment</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/graphics" rel="tag">Graphics</a>, <a href="http://inspirated.com/tag/inbox" rel="tag">Inbox</a>, <a href="http://inspirated.com/tag/inbox-stats" rel="tag">Inbox Stats</a>, <a href="http://inspirated.com/tag/nokia" rel="tag">Nokia</a>, <a href="http://inspirated.com/tag/open-source" rel="tag">Open Source</a>, <a href="http://inspirated.com/tag/pys60" rel="tag">PyS60</a>, <a href="http://inspirated.com/tag/python" rel="tag">Python</a>, <a href="http://inspirated.com/tag/series-60" rel="tag">Series 60</a>, <a href="http://inspirated.com/tag/sms" rel="tag">SMS</a>, <a href="http://inspirated.com/tag/statistics" rel="tag">Statistics</a>, <a href="http://inspirated.com/tag/symbian" rel="tag">Symbian</a>, <a href="http://inspirated.com/tag/technology" rel="tag">Technology</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2010/02/06/inbox-stats-v1-1-s60-3rd-edition-compatibility/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inbox Stats v1.0 &#8212; Because graphs speak louder than numbers</title>
		<link>http://inspirated.com/2009/05/17/inbox-stats-v10-because-graphs-speak-louder-than-numbers</link>
		<comments>http://inspirated.com/2009/05/17/inbox-stats-v10-because-graphs-speak-louder-than-numbers#comments</comments>
		<pubDate>Sat, 16 May 2009 23:00:13 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Inbox]]></category>
		<category><![CDATA[Inbox Stats]]></category>
		<category><![CDATA[Nokia]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PyS60]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Series 60]]></category>
		<category><![CDATA[SMS]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Symbian]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.inspirated.com/wordpress/?p=220</guid>
		<description><![CDATA[Changelog: As can be seen from the screenshot above, graphs can be turned on through the options menu. Implementing them resulted in two useful modules: scrolledcanvas: Provides a derived Canvas class which has built-in support for scrolling oversizes images. roundedrectangle: Provides functions for drawing rectangles with rounded corners on a Canvas or Image. Optionally, text [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p style="text-align: center"><img src="http://www.inspirated.com/uploads/inboxstats-1.0.jpg" alt="Inbox Stats v1.0" /></p>
<p>Changelog:</p>
<ul>
<li>As can be seen from the screenshot above, graphs can be turned on through the options menu. Implementing them resulted in two useful modules:
<ul>
<li><code>scrolledcanvas</code>: Provides a derived Canvas class which has built-in support for scrolling oversizes images.</li>
<li><code>roundedrectangle</code>: Provides functions for drawing rectangles with rounded corners on a <code>Canvas</code> or <code>Image</code>. Optionally, text can be given which will be prettily centered (and truncated upon requirement) in the drawn shapes.</li>
</ul>
</li>
<li>More minor code enhancements and bugfixes.</li>
</ul>
<p>You can find both the modules and the application itself <a href="http://www.inspirated.com/uploads/inboxstats-1.0.zip">here</a>. All code is released under the <a href="http://www.python.org/psf/license/">PSF license</a> so feel free to use it any way you want. Oh, and if you still haven&#8217;t figured out why anyone would be interested in the SMS stats in the first place, here&#8217;s a little quote for you:</p>
<blockquote><p>&#8220;Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital.&#8221;</p></blockquote>
<div class="shr-publisher-220"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2009/05/17/inbox-stats-v10-because-graphs-speak-louder-than-numbers">Permalink</a> |
<a href="http://inspirated.com/2009/05/17/inbox-stats-v10-because-graphs-speak-louder-than-numbers#comments">2 comments</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/graphics" rel="tag">Graphics</a>, <a href="http://inspirated.com/tag/inbox" rel="tag">Inbox</a>, <a href="http://inspirated.com/tag/inbox-stats" rel="tag">Inbox Stats</a>, <a href="http://inspirated.com/tag/nokia" rel="tag">Nokia</a>, <a href="http://inspirated.com/tag/open-source" rel="tag">Open Source</a>, <a href="http://inspirated.com/tag/pys60" rel="tag">PyS60</a>, <a href="http://inspirated.com/tag/python" rel="tag">Python</a>, <a href="http://inspirated.com/tag/series-60" rel="tag">Series 60</a>, <a href="http://inspirated.com/tag/sms" rel="tag">SMS</a>, <a href="http://inspirated.com/tag/statistics" rel="tag">Statistics</a>, <a href="http://inspirated.com/tag/symbian" rel="tag">Symbian</a>, <a href="http://inspirated.com/tag/technology" rel="tag">Technology</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2009/05/17/inbox-stats-v10-because-graphs-speak-louder-than-numbers/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SMS Inbox statistics for Series 60 mobile phones v0.2</title>
		<link>http://inspirated.com/2009/05/12/sms-inbox-statistics-for-series-60-mobile-phones-v02</link>
		<comments>http://inspirated.com/2009/05/12/sms-inbox-statistics-for-series-60-mobile-phones-v02#comments</comments>
		<pubDate>Tue, 12 May 2009 14:04:26 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Inbox]]></category>
		<category><![CDATA[Inbox Stats]]></category>
		<category><![CDATA[Nokia]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PyS60]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Series 60]]></category>
		<category><![CDATA[SMS]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Symbian]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.inspirated.com/wordpress/?p=217</guid>
		<description><![CDATA[Update: New version Improvements in the new version: Previous version hung up while calculating the statistics. The new version dispatches a thread for the dirty work and keeps the user interface responsive with a &#8220;Processing&#8221; notification. Contact stats are sorted in descending order by the number of messages per each contact. Code improvements for making [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><ins datetime="2009-05-16T22:36:46+00:00">Update: <a href="http://www.inspirated.com/wordpress/2009/05/17/inbox-stats-v10-because-graphs-speak-louder-than-numbers">New version</a></ins></p>
<p>Improvements in the new version:</p>
<ul>
<li><a href="http://www.inspirated.com/wordpress/2009/05/10/sms-inbox-statistics-for-series-60-mobile-phones">Previous version</a> hung up while calculating the statistics. The new version dispatches a thread for the dirty work and keeps the user interface responsive with a <em>&#8220;Processing&#8221;</em> notification.</li>
<li>Contact stats are sorted in descending order by the number of messages per each contact.</li>
<li>Code improvements for making it more &#8220;Pythonic&#8221;.</li>
</ul>
<p style="text-align: center"><a href="http://www.inspirated.com/uploads/inboxstats-0.2.zip">inboxstats.py</a></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
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #483d8b;">&quot;&quot;&quot;Script for printing trivial statistics about inbox, such as:
	Number of texts
	Number of unique contacts who sent the texts
	Number of texts sent by respective contacts
&quot;&quot;&quot;</span>
&nbsp;
__author__ = <span style="color: #483d8b;">&quot;Kamran Riaz Khan&quot;</span>
__email__ = <span style="color: #483d8b;">&quot;krkhan@inspirated.com&quot;</span>
__version__ = <span style="color: #483d8b;">&quot;0.2&quot;</span>
__copyright__ = <span style="color: #483d8b;">&quot;Copyright (c) 2009 Kamran Riaz Khan&quot;</span>
__license__ = <span style="color: #483d8b;">&quot;Python&quot;</span>
__status__ = <span style="color: #483d8b;">&quot;Production&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> appuifw, e32, inbox, <span style="color: #dc143c;">thread</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> exit_key_handler<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;Release app_lock.&quot;</span>
	app_lock.<span style="color: #dc143c;">signal</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> parse_inbox_stats<span style="color: black;">&#40;</span>stats<span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;&quot;&quot;Parse the inbox statistics,
	Updates the stats dictionary with:
		sms-count : Number of texts
		sms-contacts: List of tuples with following pairs:
			Name of contact, Number of corresponding
			(ordered according to decreasing number of texts)&quot;&quot;&quot;</span>
	curr_inbox = inbox.<span style="color: black;">Inbox</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	messages = curr_inbox.<span style="color: black;">sms_messages</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	contacts = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> messages:
		address = curr_inbox.<span style="color: black;">address</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> contacts.<span style="color: black;">has_key</span><span style="color: black;">&#40;</span>address<span style="color: black;">&#41;</span>:
			contacts<span style="color: black;">&#91;</span>address<span style="color: black;">&#93;</span> = contacts<span style="color: black;">&#91;</span>address<span style="color: black;">&#93;</span> + <span style="color: #ff4500;">1</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			contacts<span style="color: black;">&#91;</span>address<span style="color: black;">&#93;</span> = <span style="color: #ff4500;">1</span>
&nbsp;
	contacts = contacts.<span style="color: black;">items</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	contacts.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x, y: <span style="color: #008000;">cmp</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, y<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	contacts.<span style="color: black;">reverse</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-count&quot;</span><span style="color: black;">&#93;</span> = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>messages<span style="color: black;">&#41;</span>
	stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-contacts&quot;</span><span style="color: black;">&#93;</span> = contacts
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> print_inbox_stats<span style="color: black;">&#40;</span>content, stats<span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;&quot;&quot;Print inbox stats in the content Text field,
	Remembers the cursor position of Text before the call
	and points at it again after updating the content.&quot;&quot;&quot;</span>
	pos = content.<span style="color: black;">get_pos</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	statsmap = <span style="color: black;">&#91;</span>
		<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;SMS Count&quot;</span>, <span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-count&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
		<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Unique Contacts&quot;</span>, <span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-contacts&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
		<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;&quot;</span>, u<span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: black;">&#93;</span>
&nbsp;
	statsmap += <span style="color: black;">&#91;</span><span style="color: black;">&#40;</span>k, <span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>v<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> k, v <span style="color: #ff7700;font-weight:bold;">in</span> stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-contacts&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> statsmap:
		content.<span style="color: black;">style</span> = appuifw.<span style="color: black;">STYLE_BOLD</span>
		content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + <span style="color: black;">&#40;</span>i<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">and</span> u<span style="color: #483d8b;">&quot;: &quot;</span> <span style="color: #ff7700;font-weight:bold;">or</span> u<span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
		content.<span style="color: black;">style</span> = <span style="color: #ff4500;">0</span>
		content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> + u<span style="color: #483d8b;">&quot;n&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
	content.<span style="color: black;">set_pos</span><span style="color: black;">&#40;</span>pos<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
	content = appuifw.<span style="color: black;">Text</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	appuifw.<span style="color: black;">app</span>.<span style="color: black;">title</span> = u<span style="color: #483d8b;">'Inbox Stats'</span>
	appuifw.<span style="color: black;">app</span>.<span style="color: black;">body</span> = content
	appuifw.<span style="color: black;">app</span>.<span style="color: black;">exit_key_handler</span> = exit_key_handler
&nbsp;
	stats = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
	t = <span style="color: #dc143c;">thread</span>.<span style="color: black;">start_new_thread</span><span style="color: black;">&#40;</span>parse_inbox_stats, <span style="color: black;">&#40;</span>stats,<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
	content.<span style="color: black;">style</span> = appuifw.<span style="color: black;">STYLE_ITALIC</span>
	content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Processing text messages...n&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">thread</span>.<span style="color: black;">ao_waittid</span><span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>
	content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Done!nn&quot;</span><span style="color: black;">&#41;</span>
	content.<span style="color: black;">style</span> = <span style="color: #ff4500;">0</span>
&nbsp;
	print_inbox_stats<span style="color: black;">&#40;</span>content, stats<span style="color: black;">&#41;</span>
&nbsp;
	app_lock = e32.<span style="color: black;">Ao_lock</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	app_lock.<span style="color: black;">wait</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p style="text-align: center"><img src="http://www.inspirated.com/uploads/inboxstats-0.2.jpg" alt="Inbox Stats v0.2 Screenshot" /></p>
<div class="shr-publisher-217"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2009/05/12/sms-inbox-statistics-for-series-60-mobile-phones-v02">Permalink</a> |
<a href="http://inspirated.com/2009/05/12/sms-inbox-statistics-for-series-60-mobile-phones-v02#comments">2 comments</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/inbox" rel="tag">Inbox</a>, <a href="http://inspirated.com/tag/inbox-stats" rel="tag">Inbox Stats</a>, <a href="http://inspirated.com/tag/nokia" rel="tag">Nokia</a>, <a href="http://inspirated.com/tag/open-source" rel="tag">Open Source</a>, <a href="http://inspirated.com/tag/pys60" rel="tag">PyS60</a>, <a href="http://inspirated.com/tag/python" rel="tag">Python</a>, <a href="http://inspirated.com/tag/series-60" rel="tag">Series 60</a>, <a href="http://inspirated.com/tag/sms" rel="tag">SMS</a>, <a href="http://inspirated.com/tag/statistics" rel="tag">Statistics</a>, <a href="http://inspirated.com/tag/symbian" rel="tag">Symbian</a>, <a href="http://inspirated.com/tag/technology" rel="tag">Technology</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2009/05/12/sms-inbox-statistics-for-series-60-mobile-phones-v02/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SMS Inbox statistics for Series 60 mobile phones</title>
		<link>http://inspirated.com/2009/05/10/sms-inbox-statistics-for-series-60-mobile-phones</link>
		<comments>http://inspirated.com/2009/05/10/sms-inbox-statistics-for-series-60-mobile-phones#comments</comments>
		<pubDate>Sun, 10 May 2009 15:03:59 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Inbox]]></category>
		<category><![CDATA[Inbox Stats]]></category>
		<category><![CDATA[Nokia]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PyS60]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Series 60]]></category>
		<category><![CDATA[SMS]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Symbian]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.inspirated.com/wordpress/?p=216</guid>
		<description><![CDATA[Update: New version Self-indulgence is what I do best. It usually results in me trying to figure out random statistics about my personal life; e.g., graphs about which hours of day I&#8217;m mostly awake on and pie-charts about my bathroom habits. Such stuff doesn&#8217;t only make me feel more important than I actually am, but [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><ins datetime="2009-05-12T14:06:12+00:00">Update: <a href="http://www.inspirated.com/wordpress/2009/05/12/sms-inbox-statistics-for-series-60-mobiles-phones-v02">New version</a></ins></p>
<p>Self-indulgence is what I do best. It usually results in me trying to figure out random statistics about my personal life; e.g., graphs about which hours of day I&#8217;m mostly awake on and pie-charts about my bathroom habits. Such stuff doesn&#8217;t only make me feel more important than I actually am, but also polishes my fundamental math skills which were lost while trying to calculate average number of viruses a Windows user is hit by on an yearly basis.</p>
<p>Texting is what I do second best. Combine the two of my most productive practices and the need emerges of having a way to produce useless statistics about my cell phone&#8217;s inbox. This is where PyS60 comes to the rescue. In my <a href="http://www.inspirated.com/wordpress/2009/05/09/python-for-series-60-reinvent-the-ophidian-addiction-on-mobile-phones">previous post</a> I praised Python&#8217;s sex appeal. Here&#8217;s the demonstration:</p>
<ul>
<li>Total time spent with Python: <em>Less than a week</em></li>
<li>Total time spent with PyS60: <em>Less than a minute</em></li>
<li>Total time spent with Symbian development: <em>Less than never</em></li>
</ul>
<p>And still, even a total n00b like me could easily accomplish what he wanted to, using only the library reference manual and 70 lines of understandable code:</p>
<p style="text-align: center"><a href="http://www.inspirated.com/uploads/inboxstats-0.1.zip">inboxstats.py</a></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
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">&quot;&quot;&quot;Script for printing trivial statistics about inbox, such as:
	Number of texts
	Number of unique contacts who sent the texts
	Number of texts sent by respective contacts
&quot;&quot;&quot;</span>
&nbsp;
__author__ = <span style="color: #483d8b;">&quot;Kamran Riaz Khan &lt;krkhan@inspirated.com&gt;&quot;</span>
__version__ = <span style="color: #483d8b;">&quot;$Revision: 0.1 $&quot;</span>
__date__ = <span style="color: #483d8b;">&quot;$Date: 2009/05/10 15:30:00 $&quot;</span>
__copyright__ = <span style="color: #483d8b;">&quot;Copyright (c) 2009 Kamran Riaz Khan&quot;</span>
__license__ = <span style="color: #483d8b;">&quot;Python&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> appuifw
<span style="color: #ff7700;font-weight:bold;">import</span> e32
<span style="color: #ff7700;font-weight:bold;">import</span> inbox
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> exit_key_handler<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;Release app_lock.&quot;</span>
	app_lock.<span style="color: #dc143c;">signal</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> inbox_stats<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;&quot;&quot;Parse the inbox statistics,
	Returns the dictionary:
		sms-count : Number of texts
		sms-contacts: Dictionary with the pairs:
			contact-name : Number of texts from contact&quot;&quot;&quot;</span>
	cur_inbox = inbox.<span style="color: black;">Inbox</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	messages = cur_inbox.<span style="color: black;">sms_messages</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	contacts = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> messages:
		address = cur_inbox.<span style="color: black;">address</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> contacts.<span style="color: black;">has_key</span><span style="color: black;">&#40;</span>address<span style="color: black;">&#41;</span>:
			contacts<span style="color: black;">&#91;</span>address<span style="color: black;">&#93;</span> = contacts<span style="color: black;">&#91;</span>address<span style="color: black;">&#93;</span> + <span style="color: #ff4500;">1</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			contacts<span style="color: black;">&#91;</span>address<span style="color: black;">&#93;</span> = <span style="color: #ff4500;">1</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#123;</span>
		<span style="color: #483d8b;">&quot;sms-count&quot;</span> :  <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>messages<span style="color: black;">&#41;</span>,
		<span style="color: #483d8b;">&quot;sms-contacts&quot;</span> :  contacts
		<span style="color: black;">&#125;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
	content = appuifw.<span style="color: black;">Text</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	appuifw.<span style="color: black;">app</span>.<span style="color: black;">title</span> = u<span style="color: #483d8b;">'Inbox Stats'</span>
	appuifw.<span style="color: black;">app</span>.<span style="color: black;">body</span> = content
	appuifw.<span style="color: black;">app</span>.<span style="color: black;">exit_key_handler</span> = exit_key_handler
&nbsp;
	stats = inbox_stats<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	statsmap = <span style="color: black;">&#40;</span>
		<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;SMS Count&quot;</span>, <span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-count&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
		<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Unique Contacts&quot;</span>, <span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-contacts&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
		<span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> statsmap:
		content.<span style="color: black;">style</span> = appuifw.<span style="color: black;">STYLE_BOLD</span>
		content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + u<span style="color: #483d8b;">&quot;: &quot;</span><span style="color: black;">&#41;</span>
		content.<span style="color: black;">style</span> = <span style="color: #ff4500;">0</span>
		content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> + u<span style="color: #483d8b;">&quot;n&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
	content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;n&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> k, v <span style="color: #ff7700;font-weight:bold;">in</span> stats<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;sms-contacts&quot;</span><span style="color: black;">&#93;</span>.<span style="color: black;">iteritems</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
		content.<span style="color: black;">style</span> = appuifw.<span style="color: black;">STYLE_BOLD</span>
		content.<span style="color: black;">add</span><span style="color: black;">&#40;</span>k + u<span style="color: #483d8b;">&quot;: &quot;</span><span style="color: black;">&#41;</span>
		content.<span style="color: black;">style</span> = <span style="color: #ff4500;">0</span>
		content.<span style="color: black;">add</span><span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>v<span style="color: black;">&#41;</span> + u<span style="color: #483d8b;">&quot;n&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
	app_lock = e32.<span style="color: black;">Ao_lock</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	app_lock.<span style="color: black;">wait</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Which gives me:</p>
<p style="text-align: center"><img src="http://www.inspirated.com/uploads/inboxstats-0.1.jpg" alt="Inbox Stats Screenshot" /></p>
<div class="shr-publisher-216"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2009/05/10/sms-inbox-statistics-for-series-60-mobile-phones">Permalink</a> |
<a href="http://inspirated.com/2009/05/10/sms-inbox-statistics-for-series-60-mobile-phones#comments">4 comments</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/inbox" rel="tag">Inbox</a>, <a href="http://inspirated.com/tag/inbox-stats" rel="tag">Inbox Stats</a>, <a href="http://inspirated.com/tag/nokia" rel="tag">Nokia</a>, <a href="http://inspirated.com/tag/open-source" rel="tag">Open Source</a>, <a href="http://inspirated.com/tag/pys60" rel="tag">PyS60</a>, <a href="http://inspirated.com/tag/python" rel="tag">Python</a>, <a href="http://inspirated.com/tag/series-60" rel="tag">Series 60</a>, <a href="http://inspirated.com/tag/sms" rel="tag">SMS</a>, <a href="http://inspirated.com/tag/statistics" rel="tag">Statistics</a>, <a href="http://inspirated.com/tag/symbian" rel="tag">Symbian</a>, <a href="http://inspirated.com/tag/technology" rel="tag">Technology</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2009/05/10/sms-inbox-statistics-for-series-60-mobile-phones/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.943 seconds -->

