Fixing Grub in UEFI mode

Boot Repair never worked for me. Despite the dual boot, Windows booted every time and so I had a workaround using Escape key and following up Boot Options from there which was always an inconvenience. Another temporary fix had to be repeated. So the permanent that has been successful is discussed ahead.

Using terminal:

gksu gedit /etc/default/grub

In this file, find the line:


Edit this line to look like:

GRUB_CMDLINE_LINUX="acpi_backlight=vendor nouveau.modeset=1"

Save the file and issue a final command to flush the new changes:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Reboot and enjoy!

Untangling WiFi Issue in Ubuntu 16.04

After successful installation of Ubuntu 16.04 on my HP Envy x360, I confronted an issue with WiFi with status device not ready. Researching the issue, I found it happens to be a common issue with this LTS. Moving on to fixing it, I tried numerous solutions and each of them proved futile. After the arduous attempts, I found the needle in the haystack and it was specified for the HP Envy series only. If you encounter a similar issue, follow up the steps below-

First check the results for

lsmod | grep acer

If the above command returns


Then you should blacklist the module using

echo "blacklist acer_wmi" | sudo tee -a /etc/modprobe.d/blacklist.conf

Reboot and you are done!

Just Not a Quill Skill

Calligraphy has been an aesthetic pleasure since ancient times. From lettering formal texts in bygone periods to the penmanship in the prevalent era that covers the ornamental writing for wedding planning companies, graphic design firms and educational institutes, calligraphy continues to be an epitome of eternal beauty.

Living in a rush, often we do not get enough time to learn things from scratch and be the master in the field. To be exemplary in calligraphy, one can get clued up about a few plain sailing techniques and create his/her own sensations pretty soon. This article will explain an effortless method to fabricate a beautiful work of art.

All that you require is a plain white paper of the size of the art you want to make, a pencil (since you are a novice yet just like me), a black pen (can be colored, it is all your choice). Remember there are no rules, you just follow your heart and you will definitely end up with a beauty. We are going to learn the down-stroke technique. You may wonder about all those calligraphy pens, nibs being used by professionals. No you don’t have to spend anything on those for now.

So now gear yourself up. Write anything that you want to smarten up with the technique.

Next thing you gotta do is create down-strokes. A down-stroke is when you move your pen/pencil in downward direction. So create down-strokes for all the letters. Keep the gap between the two lines constituting the down-stroke uniform. Next just fill up the gap of the down-strokes as done below. Again no constraints on how you want to fill in the gap, partially or completely, left side filled or right side filled, all your choice. Notice the filling variations in the quote I wrote below.

The same thing that would have been accomplished with much more hard work i.e. learning quilling with the calligraphy pens, you just did it trouble-free. Well that’s awesome! 😀

If done appropriately, you can create arts using the same technique. I believe it will be hard to tell if you created your artwork with dipping pens and following the quilling process or you did it with the simple use of a ball pen. Who says calligraphy is just a quill skill. Well I say it is not!

Happy quilling! 😉

Change Main Activity in Android

Often we miss out adding splash screen of the application in the initial development phases, or for an instance you might want to change the main activity or the launcher activity at some later stage of development. In order to incorporate this change, a minor modification in AndroidManifest.xml file is to be done.

Say you have two activities A and B. Say initially A is the main activity and now you want to make activity B as the main activity. Open the AndroidManifest.xml file. Initially the entry for activity A in the manifest looks like:

<activity android:name=".A">
    <intent -filter>
        <action android:name="android.intent.action.MAIN"></action>
        <category android:name="android.intent.category.LAUNCHER"></category>

Either delete the lines in the intent-filter tag or replace the activity name with B and add a new entry for activity A.

Overall the activity B’s entry should be like:

<activity android:name=".B">
    <intent -filter>
        <action android:name="android.intent.action.MAIN"></action>
        <category android:name="android.intent.category.LAUNCHER"></category>

A single line entry for activity A will look like:

<activity android:name=".A"></activity>

It’s pretty simple and clear, all you have to do is replace the name or add a new entry.

Generate PDF of Reveal Presentation

Recently I needed a PDF file of a presentation created using reveal.js. The use of Decktape has been done which is a high-quality PDF exporter for HTML5 presentation frameworks. Quickly follow up the commands below to effectuate PDF generation:

  1. curl -L | tar -xz –exclude phantomjs
  2. cd decktape-1.0.0/
  3. curl -L -o phantomjs
  4. chmod +x phantomjs
  5. ./phantomjs decktape.js {presentation-url} {pdf-file-name}

It was quick and short. Wasn’t it? 😀

Passing Data using SharedPreferences

Sometimes while passing data between two activities, we are just concerned with passing data and not launching the activity to which the data is passed. SharedPreferences make this data passing easier without necessitating launch of the recipient activity. The usage is discussed briefly below:

Say you have two activities A and B where A is the sender and B is the recipient. Use the following code in activity A.

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(A.this);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("string", "This is a string.");
editor.putInt("number", 50);

In activity B, use the following code to receive the variables from sender activity:

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String s = prefs.getString("string", "hello");
Integer i = prefs.getInt("number", 0);

Default values should be set in the getString(), getInt() or any of the get methods used in the recipient activity. The variables in which the received values are stored can be used for further processing in activity B.

For further details on SharedPreferences, the official documentation can be checked at this link.

Installing Jabref

Jabref is an application to manage bibliography. It’s installation is pretty simple. Running the following command in Ubuntu 14.04 installs version 2.8 of Jabref while the latest one is 3.6.

sudo apt-get install jabref

The latest version can be obtained from here. You need Java version 1.6 or newer. On obtaining the jar file, you have to run it using the command:

java -jar JabRef_3.6.jar

Next to add launcher in the Start menu, follow these steps:

  1. cd ~/.local/share/applications/
  2. vim JabRef.desktop
  3. Make your file look like:
[Desktop Entry]
Exec=java -jar /path/to/Jabref/jar/file/JabRef_3.6.jar

The logo can be obtained from here. Save and exit. You have it in your launcher. Create your database and enjoy!

Algorithm Complexity : Recursion Tree

In this post, I aim to explain a method of solving recurrence relations, the result of which will give the complexity of the relation. The performance of the algorithm varies with the input size given to it.

Often counting the number of steps performed by algorithm are used to measure its performance. However, for larger input sizes, this process becomes cumbersome. Also such methods are bound to hardware specifications etc.

The first method we will follow up is Recursion Tree method. A recursion tree for the given recurrence relation is created first. The number of nodes at each level are counted and time taken at the corresponding level is computed. To obtain final result, the time taken at all levels is added up.

The pattern of time computed is observed. Most of the times it is an Arithmetic Progression or a Geometric Progression. The constants are discarded at the end to obtain complexity in terms of input size only. Let us use a simple example deploying the Recursion Tree method.

T(n) = 2 T(n/2) + n2

We start with the non-recurrent value as the root. The expression n2 is non-recurrent here, so it will be the root of our tree.

The next thing is to see the constant value with the recurrent value i.e. T(n/2) here. The constant 2 with it depicts the number of children each node in the tree will have. So the root node will have 2 children here and so on for the subsequent nodes.


On adding up time at different levels, we have the expression:
n2 + 2 * (n/2)2 + 4 * (n/4)2 + ..... + 0
= n2 (1 + 1/2 + 1/4 + ..... + 0)
= n2 (1/(1-1/2))
= n2 (1/(1/2))
= n2 * 2

Now discarding the constant, we have T(n) = O(n2). So the complexity of the recurrence relation is of the order n2 using the recursion tree method.

Menu in action

It is time to bring into being some data in the controller we created by initialising an array for the options in the menu. Create a variable menuoptions in maincontroller.js as follows:

    name: 'Home'
    name: 'Features'
    name: 'Pricing'
    name: 'Sign Up'

Now to populate these options in the menu, create a div element in index.html. ng-repeat is used in order to iterate over the elements in an array, $index is used to access elements at different indices of the array.

 <div class="nav" ng-repeat="option in menuoptions">
      <li><a href="#" ng-click="display($index)">{{ }}</a></li>

The ng-click directive is used to specify the behavior of the element being clicked. Here on clicking the menu option, the display function is called which we define next in the controller.

$scope.display=function(index) {
                 var menuname= $scope.menuoptions[index].name;

The variable menuname stores the name of different menu options available and alerts the corresponding name whenever a menu item is clicked. So we learnt using directives ng-repeat and ng-click.

The menubar example can be seen running at here.

My Inception in AngularJS

Make hunger thy sauce, as a medicine for health.

Keeping an insight in learning new things upkeeps the blooming of mind. My new intimacy over the past couple days has been with AngularJS. I have never been into substantial web development.

AngularJS enhances the development of front-end applications that are well-structured, easily maintainable and testable.

In this series, I will illustrate creating a small example using AngularJS. The initial step to this taught me other things I am a novice in, including CSS. Below is a screenshot of what we will have by the end:

If you wish to maintain a local copy, get the source from here and follow the instructions to run your app on the localhost. After you start your server using npm start command, you will see a default application running. For our example, create a new directory, say myMenubar.

Create a file named main.js. This file will contain the modules that will be booted whenever the application is run. Let us define the module for our app.

var menubar = angular.module('myMenu',[]);

So by doing this, we have instantiated a module named myMenu for our application. Next create your index.html file and add the following content to it:

    <script src="//"></script>
    <script src="main.js"></script>
    <script src="maincontroller.js"></script>
    <title>AngularJS Example</title>
  <body ng-app="myMenu">
    <div ng-controller="MainController">
      <h3 align="center">{{ title }}</h3>

The first script points to the AngularJS script, the second is the one containing the modules of the app, the third one defines the controller, about which we will talk next. The ng-app element tells when to launch AngularJS. Its value is the name of the module we set in main.js. It is called directive and defines the scope of the application.

Now it is time to create a controller. It handles all the app’s data. Create mainController.js and add following content to it:

  $scope.title='Sample text written using AngularJS';

The name of the controller is mainController and is added to a div element in index.html. The ng-controller defines the scope of the controller of the app. The properties defined in the controller are accessible in the div. The title property is attached to a variable $scope and will be accessed using expression {{ title }}. $scope binds the controller values to the DOM elements.

When you refresh your localhost, http://localhost:8000/menubar/, you get the string stored in the title on your page as following:


You created a simple app that involved use of a controller, a directive and an expression. Hope this is enough food for now. 😉 We will be creating the example in the next part of the series. Keep learning!