Getting a good deal from your Xbox One

I recently purchased an Xbox One X, mostly because it is supposed to be the most powerful console in the world (at the time of writing) and also because I thought the Xbox Live Gold deals seemed pretty good. As you might have already figured, I haven’t owned an Xbox before. Neither have I owned any other console for that matter. So I suppose I feel a little satisfaction at getting the most powerful console as my first console.

Well anyway, as I said I really liked the Xbox Gold deals. The part that I thought was really good was that you could play Xbox 360 games on an Xbox One. Also, the fact that I’d be getting 4 games a month with Gold. Little did I know that I had to download the Xbox 360 games on a Xbox 360! So when my subscription started, I was able to download the two Xbox One games but not the two Xbox 360 games. I really don’t know the point of this, but yeah it’s nothing short of silly.

I somehow got the intuition to contact customer support and ask them about this. Thankfully, I got a great response and a solution to my queries. Apparently, you can redeem the two other Xbox 360 games on the Xbox One by physically signing in on an Xbox 360 and then downloading them. Luckily for me, there was an Xbox 360 at my workplace and the rest was easy. But honestly, I searched high and low for this answer and I didn’t find anything that would help. Maybe I wasn’t looking in the right place. The Xbox at my workplace is 4Gb and the game was 12Gb, so I had to plug in an external drive. The download to the drive didn’t start however, but the game did get added to my list of games (the purchase was successful). So as long as the space on the drive is more than that of the game, you can purchase it.

Code::Blocks: Switching to a previously active tab

This was one of my qualms with Code::Blocks when I started using it. I’m used to working with VSCode and even with Visual Studio which have the feature that allows you to return to the previously active tab with Ctrl + Tab. While it might be a little annoying to get used to at first, it’s a really handy feature.

In Code::Blocks the same key binding does something else, it switches to the next tab in the chronological order that they are placed on the dashboard. For this reason, I began to search if there was any possibility of there being a way around this. What I found was surprisingly simple. The shortcut here is Alt + Arrow_Key. Might take a little getting used to, but I am glad that it exists!

Using doAsyncResult in Anko

I was stuck on this for a little while since it wasn’t updated in the documentation and also since I am still a newbie at Kotlin 😉

Some of the description has been already added in the code, as you can see. Let me explain the premise of this solution in any case. The problem arose because I had to perform a network task in the onCreate method and as you know we can’t normally perform a network task in the uiThread. Luckily, Anko provides an elegant solution to this without having the need to implement an AsyncTask interface. doAsync runs whatever task you give it but does not return anything. However, although doAsyncResult is similar to doAsync it can additionally return an object.

A Merry Christmas to you!

Switching over from http to https

Hip hip hurray! I recently made the switch using a popular and open source service known as Let’s Encrypt. Its service provides an SSL layer over the connection so that information sent to the server will not be understandable by the attacker even if they listen on the network. Well, to be honest I’ve been wanting to do this for a long time, but I did not know about this free service before! It works really well and a couple of tutorials helped me set up my Nginx WordPress installation for https.

So yeah, those lines above did it for me. But before you add them to your Nginx configuration file, follow the steps given on the Let’s Encrypt site. You need to start by installing certbot on your system, then create certificates and keys. Since these certificates expire after 90 days, you also need to renew them periodically. But rest assured, the setup was easier than I had expected, you should certainly give it a try. Not to mention that it’s free 🙂

Creating a Bootable USB

Recently, I had the need to create a bootable USB to install the new LTS version of Ubuntu on my laptop. I stumbled upon a tool called Rufus which did the trick very well.

But there were several problems along the way, most because there weren’t clear instructions on all the sites that I visited in order to learn how to create a bootable USB.

The first thing that you have to do is download the tool, whichever OS you are on. Run it, and browse for the disk image. Select the GPT partition style in the dropdown menu, and now the most important part:

Set Create bootable disk using to DD tools!

I was stuck here because I was using ISO image instead. When I tried booting my USB on startup I got a “Missing operating system” message. I got the same message even when I created the bootable USB using the tool provided by Ubuntu!

How the LinkedList class in Java works

I will explain how to perform operations like add, push, pop, poll, etc on LinkedList and what they mean. At first, it may seem a bit confusing, but I hope this article resolves a few conflicts.

A simple LinkedList of Strings declaration and definition looks like this:

There are several ways to add new elements to a LinkedList, but they mean and do different things. I will show you how each function works one by one.


One of the first methods you might encounter to add an element to a LinkedList is add. You can make use of add function in this manner:

Now let’s try to do the same with push!


We can conclude from this that add puts the element at the first position and then moves on to further positions. push on the other hand inserts elements quite like a stack. The element that is inserted first is the last when we traverse the linked list.

Let’s look at ways to fetch elements from the LinkedList. For this, we need to assume that the linked list already has some elements. Assume that for the subsequent examples, the LinkedList contains elements added using the add method like above.


Just a reminder that elements are added in the same fashion as in add.

Since pop and poll are nearly the same (poll returns null when the list is empty whereas pop throws an exception) I will not discuss poll.


Just a reminder that elements are added in the same fashion as in add.

As can be seen, pollFirst and pop function produce similar output.


Just a reminder that elements are added in the same fashion as in add.

And finally, pollLast!

The confusing yet awesome behaviour of the DatagramSocket class

One of the recent projects that I am doing involves using UDP datagrams for communication. The DatagramSocket class in Java enables me to use that feature. At first, I wasn’t aware of all the features of the class, but as I started coding and explored different methods of using that package, several more things became clear to me. Well, firstly the documentation and tutorials that I looked up to understand how to use the class gave me a very minimalistic approach to using it. So, let me clarify how this class manages the network and how you can use this.

Let’s start with the constructor. For a minimalist working server, you must provide a port (otherwise packets might not get delivered to you). Basically, the DatagramSocket class takes care of listening to a port and sending data from that same port (if needed). It does not automatically send ACKs when a packet arrives. It listens, halts the process till data arrives.

A client on the other hand does not require a port to be specified in the constructor for minimalist working. Why? Because we are assuming that the client is not listening for any data (for the time being). It only sends the provided data to a specific port specified by an InetAddress. Now there is an important thing to understand about all this. If a port is not specified by the client, it randomly chooses one. Not specifying a port does not mean that a port is not required by the client to send the data! When the DatagramPacket arrives at the server’s end, the server can find out from the packet several things like the InetAddress of the source and the port through which the packet was sent. This allows the server to send data to that source through it’s address and on the port that it’s using.

The conclusion that can be drawn from these facts is pretty cool. A thread that’s listening on a port can receive packets from multiple sources, and in the same way a thread that’s sending packets can send them to different hosts!

The real important thing to remember is that you cannot use the same socket simultaneously for sending and listening. If a socket is listening on a certain port, you need to either make it stop listening and send your packet away or you need to open another socket to do so.

Of course, it is not possible to listen on multiple threads using just one socket. For this reason, one of a good architecture designing techniques for such a mechanism is as follows:

  • Listen on one socket
  • Send packets using another socket

Playing around with fx-991MS

I have a Math exam coming soon. Thought I should share a few tricks I know with the calculator most of use. First one you probably have encountered: solving a function (say f(x)) when the values of variables are given. I mostly used this while working on problems of Numerical Methods last sem. It is useful for monotonous calculations where you have one function that you don’t constantly want to re-type. Here’s how you go about doing it:

Do you see the A, B, C, D, E, F, X and Y in red? Those are your variables. Surely, these many will suffice in your equation. Assuming f(x, y) = x^2 + y^2
You press ALPHA + ‘)’ [or X] (or any other variable of your choice), then the ‘squaring’ button (x^2) and finally you do the same thing with Y. After that is done, your equation is ready! Press CALC. It prompts you for the values of X and Y respectively. Enter them and your calculator will have the answer for you.

The second trick is ‘Solving for X’. It is similar to the previous method except this is an equation not an expression. So, don’t miss out the ‘=’ in your equation (which can be inserted using ALPHA + CALC [or =]). Assume the equation to be 3X = 39
Type the equation now press SHIFT + CALC [SOLVE] twice. Yes, twice. If you press it once, it will prompt you for the value of X. When you press it twice it solves the equation. It may take time depending on the degree of the equation.

How to install flash player for Chromium

I am currently using Debian “Wheezy”, and I’ve been using it for a while now. Recently, I realized that I was browsing the web without Adobe Flash Player installed on my system. Although, I did a normal apt-get install flashplugin-nonfree things did not work. So I searched a little more and found Google’s custom flash player called Pepper Flash Player.

Installing PFP is a bit of a pickle unless you have already added backports to your repositories. To add the backports repositories, you need to add a line to sources.list file which is present in  /etc/apt/.

Add this line to sources.list,
deb wheezy-backports main contrib non-free

Now update your package list,
apt-get update

Almost done, now install package pepperflashplugin-nonfree,
apt-get -t wheezy-backports install pepperflashplugin-nonfree


Scraping Animax India!

Since Animax India Community (AIC) is going to be taken down soon, I decided to make script to scrape what I wanted to keep. People might look at it as a failure, because it fails to deliver exactly what they want, but to be honest, it doesn’t matter.

The amount of knowledge I have gained in the past few days is not bad at all. I should take breaks more often, I am unable to think.

Let’s cut to the chase. I stopped developing only because I get a unicode error when I use the Beautiful Soup library and I think some files got corrupted.

/usr/lib/python2.7/dist-packages/bs4/ UnicodeWarning: Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.
“Some characters could not be decoded, and were “

I think I know how this happened but it is probably because my laptop shuts down because of power cuts. My laptop doesn’t have a battery because I removed it. It’s dead that’s why. Well anyway, there have been quite a few power cuts here recently. So yeah, you can figure the rest. If you get any errors let me know.

That’s not all, the HTML file that I scrape is full of random meaningless characters. Makes me nauseous by just looking at it.

But here is what I have done. It should work on your computers (hopefully). You need to have the libraries: Beautiful Soup (python-bs4), Mechanize (python-mechanize). Of course, you need to have Python too! I am running it on 2.7.

Note for Windows users:
Download the libraries using this: or

Finally, here it is.!epphnTSK!_0Jr8J1Fu4qaxUXZoa84StSflqRT21LYkEMLA3x5nCE

This is how you run it:
Go to the terminal or command prompt, whichever OS you use. Navigate to the location of the file. Execute the following:


(P.S: Don’t forget to set the path variable!)
Have fun!

Everything works fine now.