Tuesday 10 November 2015

Qualcomm Wifi driver issues (Acer Aspire E5-573)


(Edited)

Oh joy!



So I struggled with finding a decent wifi driver for my Acer Aspire E-573 on Ubuntu Mate 15.10 (kernel version 4.2.0), whose particulars are as follows:

03:00.0 Network controller: Qualcomm Atheros Device 0042 (rev 30)
Subsystem: Lite-On Communications Inc Device 0806

But unfortunately, until now, I was making do with dirty hacks such as these. Needless to say, stability was needed.

But thanks to my tinkering with a parallel Arch installation on the same machine, I stumbled upon this - Qualcomm-Atheros-QCA9377-Wifi-Linux.



The README is enough to guide you through.

Thank god for Arch forums!


Complete waste of rice


The inauspicious Tilaka


Diwali, the festival of lights, is just around the corner. Of course it's is the biggest festival here in India.


Like every Indian, I like Diwali a lot too, minus the smoke and noise of the crackers of course. But for me mainly, it means that I get to buy stuff and not explain its importance to my parents.


Let's get to the point here. So every Hindu ceremony involves this practice of Tilaka, which is really not great for people with allergies. However, those (weaklings) are out of the scope of my concern.


The real issue with me is the ingredients of said Tilaka. Each Tilaka involves a bunch of kumkum or other material, water as a solvent, and rice.
Auspicious Tilaka

Lets do the math now. 

A pound of rice has about 29000 long white rice grains. 

Therefore,
                weight of single long grain = 1/29,000 pound.

Lets reduce it to 1/50,000  a pound (accounting for various grain sizes).

Assuming each Tilaka contains at least 10 grains, we get the approximate weight of rice of Tilaka per person as -

1/50000 * 10 * 0.453592 kg
= 0.0907185 g 

Now, according to the most recent census (2011), India has a 96.63 crore Hindu population. Now, each household must hold some ceremony once during the year, if they identify themselves as such.

So, multiplying the weight of a single Tilaka with the total number of people gives us -

0.0907185*96,63,00,000 grams 
87661286.55 g or

              
87.66 metric tonnes
of rice, simply wasted.
 
I'll just leave it at that.
 

Wednesday 21 October 2015

Always fetch upstream!


Welcome to n00bsland!





Everybody should remember where there come from. Including their repos.

Why you ask? Becase git merge :/


I recently edited a few files in my branch of a repo and created pull request. Well guess what? The master had moved forward.



So the usual-

1. Delete local repo

2. Add remote upstream <parent_repo_link>

git remote add upstream <parent_repo_link>

3. Update local copy.

git fetch upstream

4. Create changes (again >_<)

5. Commit and pull.


Don't be a n00b, always add upstream repo.


Monday 19 October 2015

Getting started with Raspbian - First touches


Disclaimer : All the knowledge here has been scoured from the internet.

So I got myself a Raspberry Pi 2 this month. But due to some display connectivity issues (lack of HDMI monitor, USB keyboard,etc) on my part, I was unable to use it.

Finally now though, I have got it up and running. But there are a few customizations (and fixes) that I had to do before it became usable for me.

1. The terminal hotkey 

My number one problem was that there was no terminal hotkey (that launched in the same x session). I sorely missed that, needing to click on the taskbar icon and then shifting onto the keyboard to type the update and install commands.

Adding the shortcut is no biggie. Do the following:

    sudo leafpad ~/.config/openbox/lxde-pi-rc.xml

Find the </keyboard> tag and paste these lines just before it:


    <keybind key="C-A-T">
      <action name="Execute">
        <command>lxterminal</command>
      </action>
    </keybind>

and restart.


2. The youtube play icon

So there is a glitch in epiphany because of which the play icon of youtube doesn't really go away.

5 seconds since the video started


So I just installed midori and now that's my default browser.

sudo apt-get install midori


3. Headphones audio not working

This required configuring from the rasp-config utility.

sudo raspi-config 

Goto Advanced Options -> Audio -> Force 3.5 mm.


I'll keep adding as and when I find something worth sharing.

Monday 27 July 2015

A trick for Rough work


I use a lot of my notebooks and registers and write a lot of rough notes at the back pages while I am thinking or practicing.

The one problem I was faced was with how to jot down longer notes, like programs, derivations or simply anything that ran much longer than a page, because then I'd be forced to write stuff in reverse order (E.g - begin on page 320, then goto page 319 when I run out of space, etc).


So a simple way to write rough notes would be to start upside down.

Instead of writing in the usual fashion, rotate your register/notebook by 180o.


This has the advantage that you can continue to the next page, which is actually the previous page on your notebook, but still maintain readability.

Monday 20 July 2015

Double Factorial

So today while reading wiki for graph algorithms, I came across this term n!! called double factorial. Naturally, I was petrified. A factorial time complexity is scary enough, how horrible would double factorial be? In my mind I was assuming all sorts of irrational expressions such as:

n!! = (n-1)!!(n-1)!!
     = ((n-2)!! (n-2)!!)( (n-2)!! (n-2)!!)
     = ... [You get it, right?]

But as it turns out, double factorials are not so bad after all. Actually:

n!! = n*(n-2)* (n-4)*(n-6)*...

With terminal conditions 0!! = 1!! = 1.

So, a double factorial is actually has similar complexity to sqrt(n!).

Great!

  
                  

Saturday 18 July 2015

LeetCode - Q214 - Shortest Palindrome


This question, despite being solvable by a simple O(n^2) algorithm, almost took 2 hours of my life.
Simply because I was trying to get sub-palindromes, when instead, I should have checked for longest prefix of original string matching the suffix of its reverse.

E.g.           s = "abcda"

              reverse of s = rev = "adcba"

         longest suffix of rev matching s = "a"

              Answer = "adcbabcda"
           


class Solution {
public:
    string shortestPalindrome(string s) {
        string rev = s;
        int n = s.size();
        reverse(rev.begin(),rev.end());
        for(int i=n;i>0;i--)
        {
            if(!strncmp(s.substr(0,i).c_str(),rev.substr(n-i,i).c_str(),i))
                return rev.substr(0,n-i)+s;
        }
        return rev+s;
    }
};