<?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>Ebixio</title>
	<atom:link href="http://ebixio.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://ebixio.com/blog</link>
	<description>Just another altruistic weblog</description>
	<lastBuildDate>Mon, 27 May 2013 20:20:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>From Acceleration to Displacement</title>
		<link>http://ebixio.com/blog/2013/05/27/484/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2013/05/27/484/#comments</comments>
		<pubDate>Mon, 27 May 2013 18:50:31 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=484</guid>
		<description><![CDATA[Recently I was trying to double integrate a sinusoidal acceleration (ex: a frog leaping forward) and was a bit puzzled at first why double integrating the wave resulted in no displacement after an integral number of cycles: Everybody knows that integrating once gives you velocity, and integrating twice gives you displacement (or position). But if [...]]]></description>
				<content:encoded><![CDATA[<p></p>
<p>Recently I was trying to double integrate a sinusoidal acceleration (ex: a frog leaping forward) and was a bit puzzled at first why double integrating the \(\sin(t)\) wave resulted in no displacement after an integral number of cycles:</p>
<p>\[<br />
\begin{eqnarray}<br />
v(t) = \int \sin(t) dt &#038;=&#038; -\cos(t) \\<br />
d(t) = \int -\cos(t) dt &#038;=&#038; -\sin(t)<br />
\end{eqnarray}<br />
\]</p>
<p>Everybody knows that integrating once gives you velocity, and integrating twice gives you displacement (or position). But if that&#8217;s the case, why is the displacement (\(-sin(t)\)) above sinusoidal? Shouldn&#8217;t the frog be moving forward instead of back and forth?</p>
<p>It turns out my calculus was rusty enough to where I missed one very obvious fact. In the process I learned the distinction between a <em>multiple (or double) integral</em>, which is an integral taken over different variables (ex: \(\int \int f(x, y) dx\ dy\)) and a <em>repeated integral</em> which is taken multiple times over the <em>same</em> variable. What I missed was the difference between an <em>indefinite</em> integral (shown above) and a <em>definite</em> integral (shown below).</p>
<p>So let&#8217;s make the problem a little more generic and add amplitude and frequency component to our acceleration signal, and then see what happens to it as we integrate it twice. We&#8217;ll start with an acceleration signal defined as:</p>
<p>\[A = a \sin(c*t)\]</p>
<p>and we&#8217;ll integrate it twice over the interval start..end (\(s..e\)) to see what we get.</p>
<p>For the first integration we have:</p>
<p>\[<br />
\begin{align}<br />
V_{t = e} = \int_{s}^{e} a \sin(ct) dt &#038;= \ &#8211; \frac{a \cos(ct)}{c}\bigg|_{s}^{e} \\<br />
&#038;= -\frac{a \cos(ce)}{c} + \frac{a \cos(cs)}{c}<br />
\end{align}<br />
\]</p>
<p>So that allows us to calculate the velocity at any point \( t = e \) after the starting time \(s\). Now we want to integrate a second time to get the displacement. To avoid confusion with the \(s..e\) interval used for the first integration, we&#8217;ll use \(g..h\) as the integration interval this time around. To simplify things, let&#8217;s also rename the integration constant (time independent) term \(\frac{a \cos(cs)}{c} \equiv m\).</p>
<p>\[<br />
\begin{align}<br />
D_{t = h} = \int_{g}^{h} -\frac{a \cos(ce)}{c} + m\ de &#038;= -\frac{a \sin(ce)}{c^2} + me \bigg|_{g}^{h} \\<br />
&#038;= \left[ mh - \frac{a \sin(ch)}{c^2} \right] &#8211; \left[ mg - \frac{a \sin(cg)}{c^2} \right]<br />
\end{align}<br />
\]</p>
<p>Since both integrations are over the same intervals, we know that \(g \equiv s\) and \(h \equiv e\). Now substitute everything back in and simplify:</p>
<p>\[<br />
\begin{align}<br />
D_{t = e} &#038;= \left[ mh - \frac{a \sin(ch)}{c^2} \right] &#8211; \left[ mg - \frac{a \sin(cg)}{c^2} \right] \\<br />
&#038;= \left[ me - \frac{a \sin(ce)}{c^2} \right] &#8211; \left[ ms - \frac{a \sin(cs)}{c^2} \right] \\<br />
&#038;= m(e-s)\ &#8211; \frac{a \sin(ce)}{c^2} + \frac{a \sin(cs)}{c^2} \\<br />
&#038;= \frac{a \cos(cs)}{c} (e-s)\ &#8211; \frac{a \sin(ce)}{c^2} + \frac{a \sin(cs)}{c^2}<br />
\end{align}<br />
\]</p>
<p>If we want to take into account the phase of the signal, we start with:</p>
<p>\[<br />
A = a \sin(ct + p)<br />
\]</p>
<p>and end with:</p>
<p>\[<br />
D = \frac{a \cos(cs+p)}{c} (e-s)\ &#8211; \frac{a \sin(ce+p)}{c^2} + \frac{a \sin(cs+p)}{c^2}<br />
\]</p>
<p>So there you have it. The result of integrating a sinusoidal acceleration twice on the interval \(s..e\) in order to arrive at the displacement.<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2013/05/27/484/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git &#8211; deleting the current branch is denied</title>
		<link>http://ebixio.com/blog/2012/08/01/git-deleting-the-current-branch-is-denied/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2012/08/01/git-deleting-the-current-branch-is-denied/#comments</comments>
		<pubDate>Wed, 01 Aug 2012 13:30:31 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=392</guid>
		<description><![CDATA[Here&#8217;s a solution if you ever get the following error when trying to delete the master branch in a remote repository: The reason you&#8217;re seeing the error is that HEAD on the remote repository by default contains something like this (see also line 9 in the error message above): If you have access to the [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a solution if you ever get the following error when trying to delete the master branch in a remote repository:</p>

<pre class="brush: plain; highlight: [9]; title: ; notranslate">
remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error: 
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error: 
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/master
To /somewhere/in/the/cloud/repo.git
 ! [remote rejected] master (deletion of the current branch prohibited)
error: failed to push some refs to '/somewhere/in/the/cloud/repo.git'
</pre>
<p>The reason you&#8217;re seeing the error is that HEAD on the remote repository by default contains something like this (see also line 9 in the error message above):</p>

<pre class="brush: plain; title: ; notranslate">
ref: refs/heads/master
</pre>
<p>If you have access to the remote repository, simply modify the <strong>HEAD</strong> file to point to a different branch and then you&#8217;ll be able to delete the remote master branch. There are some significant implications to modifying the remote <strong>HEAD</strong>, especially if other users are tracking that branch, so make sure you know what you&#8217;re doing if you choose to point it to some other arbitrary branch.<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2012/08/01/git-deleting-the-current-branch-is-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Android IPC binders from native code</title>
		<link>http://ebixio.com/blog/2012/07/07/using-android-ipc-binders-from-native-code/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2012/07/07/using-android-ipc-binders-from-native-code/#comments</comments>
		<pubDate>Sat, 07 Jul 2012 05:03:50 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=376</guid>
		<description><![CDATA[This is a follow-up (with actual code examples) to a post I wrote a while ago on how to use the Android IPC system from native C++ code. The code is hosted on GitHub at Android IPC binder demo. A number of readers have asked for sample code after reading the previous post, so hopefully [...]]]></description>
				<content:encoded><![CDATA[<p>This is a follow-up (with actual code examples) to a post I wrote a while ago on how to use the <a href="http://ebixio.com/blog/2011/01/03/the-android-ipc-system/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" title="The Android IPC system">Android IPC system</a> from native C++ code. The code is hosted on GitHub at <a href="https://github.com/gburca/BinderDemo" title="BinderDemo">Android IPC binder demo</a>. A number of readers have asked for sample code after reading the previous post, so hopefully this helps.</p>
<p>When executed without any arguments, the binary acts as a service (named &#8220;Demo&#8221;). When executed with an integer argument (ex: &#8220;binder 743&#8243;), the binary acts as a client that searches for the &#8220;Demo&#8221; service, binds to it, and exercises its API. To keep things simple, there&#8217;s virtually no error checking. Some debug messages are sent to stdout, and others to logcat.</p>
<p>The suggested way to run this demo to have 3 windows open and issue the following commands in them:</p>
<ol>
<li>adb logcat -v time binder_demo:* *:S</li>
<li>adb shell binder</li>
<li>adb shell binder 456</li>
</ol>
<p>Now for a brief explanation of the code. The IInterface, BpInterface, and BnInterface classes are provided by the Android framework.</p>
<p>We start by defining an interface (think AIDL) that will be shared between the service and the client:</p>

<pre class="brush: cpp; title: ; notranslate">
class IDemo : public IInterface {
    public:
        enum {
            ALERT = IBinder::FIRST_CALL_TRANSACTION,
            PUSH,
            ADD
        };
        // Sends a user-provided value to the service
        virtual void        push(int32_t data)          = 0;
        // Sends a fixed alert string to the service
        virtual void        alert()                     = 0;
        // Requests the service to perform an addition and return the result
        virtual int32_t     add(int32_t v1, int32_t v2) = 0;

        DECLARE_META_INTERFACE(Demo);
};

// This implementation macro would normally go in a cpp file
IMPLEMENT_META_INTERFACE(Demo, &quot;Demo&quot;);
</pre>
<p>Next we define the server end, which is made up of 2 classes: BnDemo, and its derived class, Demo. BnDemo extracts the arguments from the data Parcel sent by the client, calls the appropriate virtual function (implemented in the Demo class) to do the heavy-lifting, and packs the returned values (if any) into a reply Parcel to be sent back to the client.</p>

<pre class="brush: cpp; title: ; notranslate">
class BnDemo : public BnInterface&lt;IDemo&gt; {
    virtual status_t onTransact(uint32_t code, const Parcel&amp; data,
                                Parcel* reply, uint32_t flags = 0);
};

status_t BnDemo::onTransact(uint32_t code, const Parcel&amp; data,
                            Parcel* reply, uint32_t flags) {

    data.checkInterface(this);

    switch(code) {
        case ALERT: {
            alert();
            return NO_ERROR;
        } break;
        case PUSH: {
            int32_t inData = data.readInt32();
            push(inData);
            return NO_ERROR;
        } break;
        case ADD: {
            int32_t inV1 = data.readInt32();
            int32_t inV2 = data.readInt32();
            int32_t sum = add(inV1, inV2);
            reply-&gt;writeInt32(sum);
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}

</pre>
<p>This is the Demo class, which would normally do the real work on the service side of the binder.</p>

<pre class="brush: cpp; title: ; notranslate">
class Demo : public BnDemo {
    virtual void push(int32_t data) {
        // Do something with the data the client pushed
    }
    virtual void alert() {
        // Handle the alert
    }
    virtual int32_t add(int32_t v1, int32_t v2) {
        return v1 + v2;
    }
};
</pre>
<p>Now we define a service proxy, to be used on the client side. Notice again that any data the client needs to send to the service is packed in a Parcel and results (if any) are also returned in a Parcel.</p>

<pre class="brush: cpp; title: ; notranslate">
class BpDemo : public BpInterface&lt;IDemo&gt; {
    public:
        BpDemo(const sp&lt;IBinder&gt;&amp; impl) : BpInterface&lt;IDemo&gt;(impl) { }

        virtual void push(int32_t push_data) {
            Parcel data, reply;
            data.writeInterfaceToken(IDemo::getInterfaceDescriptor());
            data.writeInt32(push_data);
            remote()-&gt;transact(PUSH, data, &amp;reply);
        }

        virtual void alert() {
            Parcel data, reply;
            data.writeInterfaceToken(IDemo::getInterfaceDescriptor());
            remote()-&gt;transact(ALERT, data, &amp;reply, IBinder::FLAG_ONEWAY);
        }

        virtual int32_t add(int32_t v1, int32_t v2) {
            Parcel data, reply;
            data.writeInterfaceToken(IDemo::getInterfaceDescriptor());
            data.writeInt32(v1);
            data.writeInt32(v2);
            remote()-&gt;transact(ADD, data, &amp;reply);

            int32_t res;
            status_t status = reply.readInt32(&amp;res);
            return res;
        }
};
</pre>
<p>Finally, we start the service as follows:</p>

<pre class="brush: cpp; title: ; notranslate">
        defaultServiceManager()-&gt;addService(String16(&quot;Demo&quot;), new Demo());
        android::ProcessState::self()-&gt;startThreadPool();
</pre>
<p>And the client can now connect to the service and call some of the provided functions:</p>

<pre class="brush: cpp; title: ; notranslate">
    sp&lt;IServiceManager&gt; sm = defaultServiceManager();
    sp&lt;IBinder&gt; binder = sm-&gt;getService(String16(&quot;Demo&quot;));
    sp&lt;IDemo&gt; demo = interface_cast&lt;IDemo&gt;(binder);

    demo-&gt;alert();
    demo-&gt;push(65);
    int32_t sum = demo-&gt;add(453, 827);
</pre>
<p>There&#8217;s a lot more that could be said, but I&#8217;m not planning on writing the book on the subject. If you&#8217;ve made it this far, you should be able to figure out the rest. The full compilable code is at <a href="https://github.com/gburca/BinderDemo" title="BinderDemo">BinderDemo</a>.<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2012/07/07/using-android-ipc-binders-from-native-code/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Editing GEDCOM files with vim</title>
		<link>http://ebixio.com/blog/2012/03/05/editing-gedcom-files-with-vim/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2012/03/05/editing-gedcom-files-with-vim/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 07:02:20 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gedcom]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=356</guid>
		<description><![CDATA[GEDCOM files sometimes have no indentation. That makes it difficult to read or edit them with a text editor. Using the following simple instructions, you can auto-indent the file so that it is more readable in the vim editor. Save the next few lines into a file called gedcom_indent. Make the file executable and place [...]]]></description>
				<content:encoded><![CDATA[<p>GEDCOM files sometimes have no indentation. That makes it difficult to read or edit them with a text editor. Using the following simple instructions, you can auto-indent the file so that it is more readable in the vim editor.</p>
<p><div id="attachment_362" class="wp-caption aligncenter" style="width: 590px"><a href="http://ebixio.com/blog/wp-content/uploads/2012/03/GEDCOM-12.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://ebixio.com/blog/wp-content/uploads/2012/03/GEDCOM-12.png" alt="" title="GEDCOM Indentation" width="580" height="365" class="size-full wp-image-362" /></a><p class="wp-caption-text">Compare the readability of the two formats</p></div></p>
<p>Save the next few lines into a file called <code class="codecolorer bash default"><span class="bash">gedcom_indent</span></code>. Make the file executable and place it somewhere in your path.</p>

<pre class="brush: python; title: ; notranslate">
#!/usr/bin/env python

from __future__ import print_function
import sys

for line in sys.stdin:
    line = line.lstrip()
    try:
        level = int(line.split(' ', 1)[0])
        print('\t' * level, end='')
    except:                                                                                                                                            
        pass
    print(line, end='', sep='')
</pre>
<p>Now add the following 2 lines to your ~/.vimrc file:</p>
<pre class="brush: plain; title: ; notranslate">
autocmd BufReadPost,FileReadPost *.ged %!gedcom_indent
autocmd FileType gedcom set foldmethod=indent nolist ts=4
</pre>
<p>This tells vim to filter any file with a &#8220;ged&#8221; extension through the small gedcom_indent filter (which will add leading tabs to the file). The second line tells it to make each TAB count for 4 spaces, and to fold based on indentation.<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2012/03/05/editing-gedcom-files-with-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Quick Reference Card</title>
		<link>http://ebixio.com/blog/2011/09/24/git-quick-reference-card/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2011/09/24/git-quick-reference-card/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 22:09:13 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=342</guid>
		<description><![CDATA[Git has a lot of commands. Well over 100 of them. Most of the times you only use a handful of them, but if you&#8217;re a power-user, every once in a while you&#8217;re looking for that elusive command that you remember reading about. This Git quick reference card sums them all up for you so [...]]]></description>
				<content:encoded><![CDATA[<p>Git has a lot of commands. Well over 100 of them. Most of the times you only use a handful of them, but if you&#8217;re a power-user, every once in a while you&#8217;re looking for that elusive command that you remember reading about. <a href="http://ebixio.com/blog/wp-content/uploads/2011/09/git-qrc.pdf#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">This Git quick reference card</a> sums them all up for you so you can look up the details using Git&#8217;s help system (git help &lt;command&gt;).</p>
<p><div id="attachment_345" class="wp-caption aligncenter" style="width: 310px"><a href="http://ebixio.com/blog/wp-content/uploads/2011/09/git-qrc.pdf#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://ebixio.com/blog/wp-content/uploads/2011/09/git-0-300x211.png" alt="" title="Git Quick Reference Card - Page 1" width="300" height="211" class="size-medium wp-image-345" /></a><p class="wp-caption-text">Git Quick Reference Card - Page 1</p></div></p>
<p><div id="attachment_346" class="wp-caption aligncenter" style="width: 310px"><a href="http://ebixio.com/blog/wp-content/uploads/2011/09/git-qrc.pdf#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img src="http://ebixio.com/blog/wp-content/uploads/2011/09/git-1-300x211.png" alt="" title="Git Quick Reference Card - Page 2" width="300" height="211" class="size-medium wp-image-346" /></a><p class="wp-caption-text">Git Quick Reference Card - Page 2</p></div></p>
<p>The reference card is available as a <a href="http://ebixio.com/blog/wp-content/uploads/2011/09/git-qrc.pdf#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">PDF</a> so you can print it out. The PDF version is derived from the TeX file which is hosted at <a href="http://github.com/gburca/git-qrc">http://github.com/gburca/git-qrc</a> so anyone can update it.<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2011/09/24/git-quick-reference-card/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make wpa_cli talk to wpa_supplicant in Ubuntu</title>
		<link>http://ebixio.com/blog/2011/09/15/how-to-make-wpa_cli-talk-to-wpa_supplicant-in-ubuntu/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2011/09/15/how-to-make-wpa_cli-talk-to-wpa_supplicant-in-ubuntu/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 23:25:35 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=326</guid>
		<description><![CDATA[On a stock Ubuntu 11.04 distribution, wpa_cli can not talk to wpa_supplicant. Regardless of the options used, wpa_cli will always report: That&#8217;s because wpa_cli expects to talk to wpa_supplicant over a control socket, but the default wpa_supplicant command line options don&#8217;t create a control socket (only the D-Bus interface is activated). The fix is fairly [...]]]></description>
				<content:encoded><![CDATA[<p>On a stock Ubuntu 11.04 distribution, <strong>wpa_cli</strong> can not talk to <strong>wpa_supplicant</strong>. Regardless of the options used, <strong>wpa_cli</strong> will always report:</p>
<pre class="brush: plain; title: ; notranslate">
Could not connect to wpa_supplicant - re-trying
</pre>
<p>That&#8217;s because <strong>wpa_cli</strong> expects to talk to <strong>wpa_supplicant</strong> over a control socket, but the default <strong>wpa_supplicant</strong> command line options don&#8217;t create a control socket (only the D-Bus interface is activated).</p>
<p>The fix is fairly easy. Modify the following file:</p>
<pre class="brush: bash; title: ; notranslate">
/usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service
</pre>
<p>and pass the -O option to wpa_supplicant by replacing the</p>
<pre class="brush: plain; title: ; notranslate">
Exec=/sbin/wpa_supplicant -u -s
</pre>
<p>line with</p>
<pre class="brush: plain; title: ; notranslate">
Exec=/sbin/wpa_supplicant -u -s -O /var/run/wpa_supplicant
</pre>
<p>Notice, that&#8217;s a capital-o, not a zero in the command line.</p>
<p>Restart the supplicant with: <code class="codecolorer bash default"><span class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">killall</span> wpa_supplicant</span></code> and run <code class="codecolorer bash default"><span class="bash"><span style="color: #c20cb9; font-weight: bold;">ps</span> auxww <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> wpa_supplicant</span></code> to verify that the new options are being used.</p>
<p>If you notice that your changes are ignored, try making the same changes to:</p>
<pre class="brush: bash; title: ; notranslate">
/usr/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service
</pre>
<p>You should now be able to run <strong>wpa_cli</strong> without any command line options (or with <code class="codecolorer bash default"><span class="bash">wpa_cli <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>wpa_supplicant</span></code>) and talk to <strong>wpa_supplicant</strong>.<br />
<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2011/09/15/how-to-make-wpa_cli-talk-to-wpa_supplicant-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Smart backup for your GMail account</title>
		<link>http://ebixio.com/blog/2011/05/28/smart-backup-for-your-gmail-account/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2011/05/28/smart-backup-for-your-gmail-account/#comments</comments>
		<pubDate>Sat, 28 May 2011 19:55:18 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bagoma]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=316</guid>
		<description><![CDATA[There are a number of solutions out there that allow you to back up your Google mail, but all of them have some significant shortcomings. That&#8217;s pretty surprising given the popularity of GMail. BaGoMa aims to address all (or most) of them. BaGoMa is a command line application, so you can easily automate the backup. [...]]]></description>
				<content:encoded><![CDATA[<p>There are a number of solutions out there that allow you to back up your Google mail, but all of them have some significant shortcomings. That&#8217;s pretty surprising given the popularity of GMail. <a title="BaGoMa" href="http://sourceforge.net/p/bagoma/">BaGoMa</a> aims to address all (or most) of them.</p>
<ol>
<li>BaGoMa is a command line application, so you can easily automate the backup. A GUI might be added in the future if there&#8217;s enough of a demand for it.</li>
<li>It runs on all major operating systems: Linux, Windows, Mac OS X, basically anything that Python runs on. For Windows users the zip file even contains a stand-alone executable that has the Python interpreter and libraries built-in, so you don&#8217;t need to install anything else.</li>
<li>It is open sourced, and contributions from the community are welcomed and encouraged. That also means you can read the source code  yourself to make sure your password and emails remain private.</li>
<li>It has no arbitrary limitations on the tag/label names you can use in Google. Some other solutions out there expect you to only use ASCII. That means non-English users are out of luck. It even auto-detects the main types of folders in use so that it can skip folders such as &#8220;Spam&#8221; and &#8220;Trash&#8221;.</li>
<li>Most importantly, it is tuned to work specifically with Google mail. There are a lot of generic applications that are able to backup an IMAP account. GMail however is not a true IMAP account. For example, if you apply 5 tags/labels to an email message, it shows up in 5 different IMAP folders. From the perspective of a regular IMAP application those look like 5 distinct messages, so they get backed up 5 times. It&#8217;s not clear what would happen when you attempt to restore your mail from such a backup. Will you end up with 5 identical copies of the message, each with a single tag/label, or will you end up with a single message that has 5 tags? BaGoMa does the right thing. In this case that means the message only gets downloaded (and backed up) once, and when restored all the original tags are applied to the same message.</li>
</ol>
<p>The use of BaGoMa is extremely simple. To back up your account all you need is:</p>
<pre>bagoma --email=your_user_id@gmail.com</pre>
<p>It works seamlessly with Google Apps for Business, so if you&#8217;re hosting your business email with Google you can use your business email address instead of YourUserId@gmail.com to back up your business account. Please note that if you don&#8217;t specify a backup directory, BaGoMa will use a directory that matches your email address. Email addresses are case insensitive, but on operating systems with case-sensitive file systems you need to be consistent in how you write your email address, or specify the backup directory.</p>
<p>To restore your email you would run:</p>
<pre>bagoma --email=your_user_id@gmail.com --action=restore</pre>
<p>So what are you waiting for? Give it a try and stop worrying about forgetting your password and getting locked out of your account, or losing important emails if Google ever has an E-Mail outage.</p>
<h4>BaGoMa homepage: <a href="http://sourceforge.net/p/bagoma/">http://sourceforge.net/p/bagoma/</a></h4>
<h4>BaGoMa downloads: <a href="http://sourceforge.net/projects/bagoma/files/">http://sourceforge.net/projects/bagoma/files/</a></h4>
<h4>BaGoMa documentation: ﻿﻿﻿<a href="http://bagoma.sourceforge.net/">http://bagoma.sourceforge.net/</a></h4>
<p><!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2011/05/28/smart-backup-for-your-gmail-account/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Android IPC system</title>
		<link>http://ebixio.com/blog/2011/01/03/the-android-ipc-system/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2011/01/03/the-android-ipc-system/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 15:02:42 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=303</guid>
		<description><![CDATA[The information below comes from a number of sources, including my own experiments with the Android IPC and some disparate internet sources. The overall architecture of the Android IPC system is shown in the diagram below. It consists of four major blocks; one in kernel space, and the other three in use space. The dashed [...]]]></description>
				<content:encoded><![CDATA[<p>The information below comes from a number of sources, including my own experiments with the Android IPC and some disparate internet sources.</p>
<p>The overall architecture of the Android IPC system is shown in the diagram below. It consists of four major blocks; one in kernel space, and the other three in use space. The dashed lines represent the logical RPC calls. The solid lines represent the actual data flow.</p>
<p style="text-align: center;"><a href="http://ebixio.com/blog/wp-content/uploads/2010/12/AndroidIPC.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="aligncenter size-full wp-image-307" title="AndroidIPC" src="http://ebixio.com/blog/wp-content/uploads/2010/12/AndroidIPC.png" alt="" width="416" height="213" /></a></p>
<ul>
<li> BinderDriver: This is the core of IPC system. It passes data between a ServiceProvider(s) and a ServiceUser(s). This kernel component is provided by Android.</li>
<li>ServiceProvider: Provides some kind of service. It parses the received RPC data from the BinderDriver and does the real work. Application developers will either make use of existing service providers (such as the Camera or AudioFlinger), or in some cases will write their own.</li>
<li>ServiceManager: This is a special singleton ServiceProvider that provides service manager services for other service providers. This component is provided by Android.</li>
<li>ServiceUser: This is the client. It remote calls the ServiceProvider by generating an RPC and sending it to the BinderDriver. Application developers typically write their own ServiceUser as part of their application.</li>
</ul>
<p>Here is a typical flow of events for a fictitious MultServiceProvider (a service provider that multiplies two numbers for a client) and a MultServiceUser client which doesn&#8217;t know how to do multiplication (maybe because the numbers are quaternions) and needs to use the MultServiceProvider:</p>
<ol>
<li>ServiceManager runs first (at power-up) and registers a special node (node O) with the BinderDriver.</li>
<li>The MultServiceProvider gets an IServiceManager proxy object for the special node O by calling the global “defaultServiceManager()” function.</li>
<li>The MultServiceProvider then calls defaultServiceManager()-&gt;addService(&#8220;Multiplier&#8221;, new MultServiceProvider()) to add itself as a service provider and then waits in an infinite loop for someone to request its services. The addService RPC call is routed to the ServiceManager through the BinderDriver.</li>
<li>The BinderDriver notices that the RPC is for the ServiceManager to add a new service, so besides routing the RPC to the ServiceManager it generates another node (let&#8217;s call it node M), for the new MultServiceProvider.</li>
<li>The ServiceManager reads the data from the BinderDriver and processes the IServiceManager::addService RPC call.</li>
<li>The MultServiceUser client process gets an IServiceManager proxy object for the special node O (again by using defaultServiceManager()).</li>
<li>The client does an IServiceManager::getService(&#8220;Multiplier&#8221;) RPC call to get the MultServiceProvider. This call is routed to the ServiceManager through the BinderDriver.</li>
<li>The ServiceManager reads the RPC data from the BinderDriver, processes the IServiceManager::getService request and returns back the node representing the MultServiceProvider.</li>
<li>MultServiceUser calls MultServiceProvider::multiply(a, b). This call is routed to  the MultServiceProvider by the BinderDriver.</li>
<li>The MultServiceProvider handles the MultServiceProvider::multiply RPC call and sends the product of the 2 numbers in a reply to the BinderDriver.</li>
<li>The BinderDriver routes the reply back to the client.</li>
<li>The client reads the data from the BinderDriver which contains the result of &#8220;a * b&#8221;.</li>
</ol>
<p>In a future post I hope to discuss the whole architecture in more detail, with concrete code examples for how to use IBinder, IInterface, BBinder, BpInterface, BnInterface, etc&#8230; to create a ServiceProvider and a ServiceUser all in native C++ code on Android.<!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2011/01/03/the-android-ipc-system/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Windows proxy control script</title>
		<link>http://ebixio.com/blog/2010/12/02/windows-proxy-control-script/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2010/12/02/windows-proxy-control-script/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 06:58:00 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=282</guid>
		<description><![CDATA[Here&#8217;s a simple script that lets you toggle on or off your internet proxy in Windows. Save it to a file called Proxy.vbs on your desktop and double-click the file to execute the script. As shown below, the script will not change the proxy server address, but will simply turn it ON or OFF. If [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a simple script that lets you toggle on or off your internet proxy in Windows. Save it to a file called Proxy.vbs on your desktop and double-click the file to execute the script.</p>
<p>As shown below, the script will not change the proxy server address, but will simply turn it ON or OFF. If you want to also modify the proxy server and exception list every time you turn it on, update lines 37 and 38, and uncomment lines 40-41.</p>
<p>Parts of this script come from a comment someone posted on a web site, but I no longer have the link to provide proper attribution.</p>

<pre class="brush: vb; highlight: [37,38,40,41]; title: ; notranslate">
Const HKCU=&amp;H80000001 'HKEY_CURRENT_USER
Const HKLM=&amp;H80000002 'HKEY_LOCAL_MACHINE

Const REG_SZ		= 1
Const REG_EXPAND_SZ	= 2
Const REG_BINARY	= 3
Const REG_DWORD		= 4
Const REG_MULTI_SZ	= 7
Const HKCU_IE_PROXY	= &quot;Software\Microsoft\Windows\CurrentVersion\Internet Settings&quot;

Set oReg=GetObject(&quot;winmgmts:!root/default:StdRegProv&quot;)

Main

Sub Main()
	buttons = vbQuestion + vbYesNoCancel + vbDefaultButton1

	If GetValue(HKCU,HKCU_IE_PROXY,&quot;ProxyEnable&quot;,REG_DWORD) = 1 AND _
	Len(GetValue(HKCU,HKCU_IE_PROXY,&quot;ProxyServer&quot;,REG_SZ)) &gt; 0 Then
		' If Proxy is set then default to turning it off
		buttons = buttons + vbDefaultButton2
	End If

	choice = MsgBox(&quot;Enable the internet proxy?&quot;, buttons, &quot;Proxy setting&quot;)
	If choice = vbYes Then
		SetProxy True
	ElseIf choice = vbNo Then
		SetProxy False
	End If
End Sub

Sub SetProxy(enabled)
	If enabled = False Then
		CreateValue HKCU,HKCU_IE_PROXY,&quot;ProxyEnable&quot;,0,REG_DWORD
		MsgBox &quot;Proxy Disabled&quot;, vbInformation, &quot;Proxy OFF&quot;
	Else
		strProxyServer = &quot;MyProxySvr:80&quot;
		strProxyOveride = &quot;*.domain.com;*.domain2.com;*domain3.com&quot;
	
		'CreateValue HKCU,HKCU_IE_PROXY,&quot;ProxyServer&quot;,strProxyServer,REG_SZ
		'CreateValue HKCU,HKCU_IE_PROXY,&quot;ProxyOverride&quot;,strProxyOveride,REG_SZ
		CreateValue HKCU,HKCU_IE_PROXY,&quot;ProxyEnable&quot;,1,REG_DWORD
		MsgBox &quot;Proxy Enabled and set to:&quot; &amp; vbcrlf &amp; &quot;(&quot; &amp; strProxyServer &amp; &quot;)&quot;, vbInformation, &quot;Proxy ON&quot;
	End If
End Sub

Function CreateValue(Key,SubKey,ValueName,Value,KeyType)
	Select Case KeyType
	Case REG_SZ
		CreateValue = oReg.SetStringValue(Key,SubKey,ValueName,Value)
	Case REG_EXPAND_SZ
		CreateValue = oReg.SetExpandedStringValue(Key,SubKey,ValueName,Value)
	Case REG_BINARY
		CreateValue = oReg.SetBinaryValue(Key,SubKey,ValueName,Value)
	Case REG_DWORD
		CreateValue = oReg.SetDWORDValue(Key,SubKey,ValueName,Value)
	Case REG_MULTI_SZ
		CreateValue = oReg.SetMultiStringValue(Key,SubKey,ValueName,Value)
	End Select
End Function

Function DeleteValue(Key, SubKey, ValueName)
	DeleteValue = oReg.DeleteValue(Key,SubKey,ValueName)
End Function

Function GetValue(Key, SubKey, ValueName, KeyType)
	Dim Ret

	Select Case KeyType
	Case REG_SZ
		oReg.GetStringValue Key, SubKey, ValueName, Value
		Ret = Value
	Case REG_EXPAND_SZ
		oReg.GetExpandedStringValue Key, SubKey, ValueName, Value
		Ret = Value
	Case REG_BINARY
		oReg.GetBinaryValue Key, SubKey, ValueName, Value
		Ret = Value
	Case REG_DWORD
		oReg.GetDWORDValue Key, SubKey, ValueName, Value
		Ret = Value
	Case REG_MULTI_SZ
		oReg.GetMultiStringValue Key, SubKey, ValueName, Value
		Ret = Value
	End Select

	GetValue = Ret
End Function
</pre>
<p><!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2010/12/02/windows-proxy-control-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CygWin terminal colors</title>
		<link>http://ebixio.com/blog/2010/11/14/cygwin-terminal-colors/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://ebixio.com/blog/2010/11/14/cygwin-terminal-colors/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 05:24:21 +0000</pubDate>
		<dc:creator>Gabriel Burca</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://ebixio.com/blog/?p=271</guid>
		<description><![CDATA[Many of the default ANSI colors used by the CygWin terminal are almost unreadable. For example, the blue that is used for directories in a file listing is pretty dark and hard to read on a black background. This limits the color palette that can be used in things such as the PS1 shell prompt. [...]]]></description>
				<content:encoded><![CDATA[<p>Many of the default ANSI colors used by the CygWin terminal are almost unreadable. For example, the blue that is used for directories in a file listing is pretty dark and hard to read on a black background. This limits the color palette that can be used in things such as the PS1 shell prompt. Try the following script (<a href='http://ebixio.com/blog/wp-content/uploads/2010/11/colortable16.sh'>colortable16.sh</a>) to see what your colors currently look like.</p>
<p>The colors can be changed by clicking on the system menu in the upper-left corner and selecting &#8220;Properties&#8221;. I decided to use the same colors as the Gnome terminal.</p>
<p>This is how the colors are defined in CygWin by default:</p>
<table>
<tr>
<th>Color</th>
<th>R</th>
<th>G</th>
<th>B</th>
</tr>
<tr>
<td>Black</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Blue</td>
<td>0</td>
<td>0</td>
<td>128</td>
</tr>
<tr>
<td>Green</td>
<td>0</td>
<td>128</td>
<td>0</td>
</tr>
<tr>
<td>Cyan</td>
<td>0</td>
<td>128</td>
<td>128</td>
</tr>
<tr>
<td>Red</td>
<td>128</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Pruple</td>
<td>128</td>
<td>0</td>
<td>128</td>
</tr>
<tr>
<td>Brown</td>
<td>128</td>
<td>128</td>
<td>0</td>
</tr>
<tr>
<td>Light Gray</td>
<td>192</td>
<td>192</td>
<td>192</td>
</tr>
<tr>
<td>Dark Gray</td>
<td>128</td>
<td>128</td>
<td>128</td>
</tr>
<tr>
<td>Light Blue</td>
<td>0</td>
<td>0</td>
<td>255</td>
</tr>
<tr>
<td>Light Green</td>
<td>0</td>
<td>255</td>
<td>0</td>
</tr>
<tr>
<td>Light Cyan</td>
<td>0</td>
<td>255</td>
<td>255</td>
</tr>
<tr>
<td>Light Red</td>
<td>255</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Light Purple</td>
<td>255</td>
<td>0</td>
<td>255</td>
</tr>
<tr>
<td>Light Yellow</td>
<td>255</td>
<td>255</td>
<td>0</td>
</tr>
<tr>
<td>White</td>
<td>255</td>
<td>255</td>
<td>255</td>
</tr>
</table>
<p>This is how they should be changed so that they&#8217;re more usable:</p>
<table>
<tr>
<th>Color</th>
<th>R</th>
<th>G</th>
<th>B</th>
</tr>
<tr>
<td>Black</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Blue</td>
<td>0</td>
<td>0</td>
<td>170</td>
</tr>
<tr>
<td>Green</td>
<td>0</td>
<td>170</td>
<td>0</td>
</tr>
<tr>
<td>Cyan</td>
<td>0</td>
<td>170</td>
<td>170</td>
</tr>
<tr>
<td>Red</td>
<td>170</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Pruple</td>
<td>170</td>
<td>0</td>
<td>170</td>
</tr>
<tr>
<td>Brown</td>
<td>170</td>
<td>85</td>
<td>0</td>
</tr>
<tr>
<td>Light Gray</td>
<td>170</td>
<td>170</td>
<td>170</td>
</tr>
<tr>
<td>Dark Gray</td>
<td>85</td>
<td>85</td>
<td>85</td>
</tr>
<tr>
<td>Light Blue</td>
<td>85</td>
<td>85</td>
<td>255</td>
</tr>
<tr>
<td>Light Green</td>
<td>85</td>
<td>255</td>
<td>85</td>
</tr>
<tr>
<td>Light Cyan</td>
<td>85</td>
<td>255</td>
<td>255</td>
</tr>
<tr>
<td>Light Red</td>
<td>255</td>
<td>85</td>
<td>85</td>
</tr>
<tr>
<td>Light Purple</td>
<td>255</td>
<td>85</td>
<td>255</td>
</tr>
<tr>
<td>Light Yellow</td>
<td>255</td>
<td>255</td>
<td>85</td>
</tr>
<tr>
<td>White</td>
<td>255</td>
<td>255</td>
<td>255</td>
</tr>
</table>
<p><!-- Start Shareaholic Recommendations Automatic --><!-- End Shareaholic Recommendations Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://ebixio.com/blog/2010/11/14/cygwin-terminal-colors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
