<?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>WHMCR &#187; iPhone</title> <atom:link href="http://www.whmcr.com/category/iphone/feed/" rel="self" type="application/rss+xml" /><link>http://www.whmcr.com</link> <description></description> <lastBuildDate>Tue, 25 May 2010 10:57:32 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0</generator> <item><title>iPhone to Android SMS Converstion Script</title><link>http://www.whmcr.com/2010/05/iphone-to-android-sms-converstion-script/</link> <comments>http://www.whmcr.com/2010/05/iphone-to-android-sms-converstion-script/#comments</comments> <pubDate>Tue, 25 May 2010 10:56:29 +0000</pubDate> <dc:creator>welby</dc:creator> <category><![CDATA[Android]]></category> <category><![CDATA[Apple]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[Andorid]]></category> <category><![CDATA[Linux]]></category><guid isPermaLink="false">http://www.whmcr.com/?p=134</guid> <description><![CDATA[As promised here&#8217;s a copy of my iPhone to Android script. Just a quick and dirty python script that reads in a backup from itunes and converts it to a bit of XML able to be read in by SMS Backup and Restore on the android platform from sqlite3 import * from sqlite3 import * from xml.sax.saxutils [...]]]></description> <content:encoded><![CDATA[<p>As promised here&#8217;s a copy of my iPhone to Android script. Just a quick and dirty python script that reads in a backup from itunes and converts it to a bit of XML able to be read in by SMS Backup and Restore on the android platform</p><div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> sqlite3 <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #ff7700;font-weight:bold;">from</span> sqlite3 <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">sax</span>.<span style="color: black;">saxutils</span> <span style="color: #ff7700;font-weight:bold;">import</span> escape
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">codecs</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
f = <span style="color: #dc143c;">codecs</span>.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'sms.xml'</span>,<span style="color: #483d8b;">'w'</span>,<span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span>
f.<span style="color: black;">write</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: #483d8b;">'&lt; ?xml version='</span><span style="color: #ff4500;">1.0</span><span style="color: #483d8b;">' encoding='</span>UTF-<span style="color: #ff4500;">8</span><span style="color: #483d8b;">' standalone='</span>yes<span style="color: #483d8b;">' ?&gt;
&lt;smses&gt;
'</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># This is 31bb7ba8914766d4ba40d6dfb6113c8b614be442.mddata or 31bb7ba8914766d4ba40d6dfb6113c8b614be442.mdbackup usally</span>
c = connect<span style="color: black;">&#40;</span><span style="color: #483d8b;">'sms.db'</span><span style="color: black;">&#41;</span>
curs = c.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
curs.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: #483d8b;">'SELECT address,date,text,flags FROM message WHERE flags &amp;lt;5 ORDER BY date asc'</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> curs:
        a= escape<span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        d = escape<span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>row<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>
        t = row<span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span>-<span style="color: #ff4500;">1</span>
        t = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>
        b = <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&quot;'</span>,<span style="color: #483d8b;">&quot;'&quot;</span>,escape<span style="color: black;">&#40;</span><span style="color: #008000;">unicode</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</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>
&nbsp;
        f.<span style="color: black;">write</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">'&lt;sms protocol=&quot;0&quot; address=&quot;'</span>+a+<span style="color: #483d8b;">'&quot; date=&quot;'</span>+d+<span style="color: #483d8b;">'000&quot; type=&quot;'</span>+t+<span style="color: #483d8b;">'&quot; subject=&quot;null&quot; body=&quot;'</span>+b+<span style="color: #483d8b;">'&quot; toa=&quot;0&quot; sc_toa=&quot;0&quot; service_center=&quot;null&quot; read=&quot;1&quot; status=&quot;-1&quot; /&gt;'</span>+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>
<span style="color: #483d8b;">''</span><span style="color: #483d8b;">'&lt;/smses&gt;'</span><span style="color: #483d8b;">''</span> <span style="color: black;">&#41;</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://www.whmcr.com/2010/05/iphone-to-android-sms-converstion-script/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>IRSSI Prowl Notifications</title><link>http://www.whmcr.com/2009/07/irssi-prowl-notifications/</link> <comments>http://www.whmcr.com/2009/07/irssi-prowl-notifications/#comments</comments> <pubDate>Thu, 09 Jul 2009 16:39:38 +0000</pubDate> <dc:creator>welby</dc:creator> <category><![CDATA[Apple]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[irc]]></category> <category><![CDATA[irssi]]></category><guid isPermaLink="false">http://www.whmcr.com/?p=112</guid> <description><![CDATA[A quick script to send notifications from IRSSI for privmessages and also for highlights, I&#8217;ll put more commentary on later, but for now.. use strict; use vars qw&#40;$VERSION %IRSSI&#41;; use Irssi; use LWP::UserAgent; &#160; $VERSION = '0.1'; &#160; %IRSSI = &#40; authors =&#62; 'Welby McRoberts', contact =&#62; 'irssi@whmcr.com', name =&#62; 'irssi_prowler', description =&#62; 'Sends a [...]]]></description> <content:encoded><![CDATA[<p>A quick script to send notifications from IRSSI for privmessages and also for highlights, I&#8217;ll put more commentary on later, but for now..</p><div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> vars <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$VERSION</span> <span style="color: #0000ff;">%IRSSI</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Irssi<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> LWP<span style="color: #339933;">::</span><span style="color: #006600;">UserAgent</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$VERSION</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'0.1'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">%IRSSI</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>
        authors <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'Welby McRoberts'</span><span style="color: #339933;">,</span>
        contact <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'irssi@whmcr.com'</span><span style="color: #339933;">,</span>
        name <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'irssi_prowler'</span><span style="color: #339933;">,</span>
        description <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'Sends a notification to Prowl to alert an iPhone of a new highlighted message'</span><span style="color: #339933;">,</span>
        url <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'http://www.whmcr.com/2009/07/irssi-prowl-notifications'</span><span style="color: #339933;">,</span>
        changes <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'Friday, 10 Jun 2009'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">######## Config</span>
<span style="color: #b1b100;">my</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$PRIV_PRI</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$PRIV_EVENT</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$HI_PRI</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$HI_EVENT</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$APP</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$UA</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$APIKEY</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$PRIV_PRI</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$PRIV_EVENT</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'Private Message'</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$HI_PRI</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$HI_EVENT</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'Highlight'</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$APP</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'irssi'</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$UA</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'irssi_prowler'</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$APIKEY</span><span style="color: #339933;">=</span><span style="color: #ff0000;">'7b5d817bd95911b4c049e3034dcf7a96dfa3fb53'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">########</span>
&nbsp;
<span style="color: #666666; font-style: italic;">####### Highlights</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> highlight <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$dest</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$stripped</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$dest</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span>level<span style="color: #009900;">&#125;</span> <span style="color: #339933;">&amp;</span> MSGLEVEL_HILIGHT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;prowl($HI_PRI, $APP, $HI_EVENT, $text)&quot;</span><span style="color: #339933;">;</span>
                prowl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$HI_PRI</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$APP</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$HI_EVENT</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">####### Private Messages</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> priv <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$server</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$nick</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$host</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$channel</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;prowl($PRIV_PRI, $APP, $PRIV_EVENT, $text)&quot;</span><span style="color: #339933;">;</span>
        prowl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$PRIV_PRI</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$APP</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$PRIV_EVENT</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">####### Prowl call</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> prowl <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$priority</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$application</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$event</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$description</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$request</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$response</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$lwp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #ff0000;">'pri: '</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$priority</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #ff0000;">'app: '</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$application</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #ff0000;">'event: '</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$event</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #ff0000;">'description: '</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$description</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">######## Setting up the LWP</span>
        <span style="color: #0000ff;">$lwp</span> <span style="color: #339933;">=</span> LWP<span style="color: #339933;">::</span><span style="color: #006600;">UserAgent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$lwp</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">agent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$UA</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;"># URL Encode</span>
        <span style="color: #0000ff;">$application</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/([^A-Za-z0-9])/sprintf(&quot;%%%02X&quot;, ord($1))/seg</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$event</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/([^A-Za-z0-9])/sprintf(&quot;%%%02X&quot;, ord($1))/seg</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$description</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/([^A-Za-z0-9])/sprintf(&quot;%%%02X&quot;, ord($1))/seg</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;"># Setup the url</span>
        <span style="color: #0000ff;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000066;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;https://prowl.weks.net/publicapi/add?apikey=%s&amp;priority=%d&amp;application=%s&amp;event=%s&amp;description=%s&amp;&quot;</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">$APIKEY</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">$priority</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">$application</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">$event</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">$description</span>
                                        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #0000ff;">$url</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$request</span> <span style="color: #339933;">=</span> HTTP<span style="color: #339933;">::</span><span style="color: #006600;">Request</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>GET <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$response</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$lwp</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">request</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">print</span> <span style="color: #0000ff;">$response</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">####### Bind &quot;message private&quot; to priv()</span>
Irssi<span style="color: #339933;">::</span><span style="color: #006600;">signal_add_last</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;message private&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;priv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">####### Bind &quot;print text&quot; to highlights()</span>
Irssi<span style="color: #339933;">::</span><span style="color: #006600;">signal_add_last</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;print text&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;highlight&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://www.whmcr.com/2009/07/irssi-prowl-notifications/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 25/30 queries in 0.006 seconds using apc

Served from: www.whmcr.com @ 2010-07-31 19:10:18 -->