Tuesday, 21 February 2017

Speed up your Make

How to speed up your make process on a multi core machine.

The Make Process


Whenever you are using make without arguments just a single core of your machine is used. A single process is created, which runs on one core.

No matter what kind of insanely awesome working computer you might have you are simply going to get the performance of a single core unless you create multiple process.

The make command allows you to specify the number of processes using the -j argument


Tuesday, 14 February 2017

Write a C++ program to read the HTTP header and analyze the parameters.

Q: Write a C++ program to read the HTTP header and analyze the parameters.


Test Environment


Dependencies: Libcrafter
OS: Fedora 20
Testing Environment : Switched Lan with Promiscuous Mode On for NIC


Code

Friday, 10 February 2017

FireFox Shortcuts Essentials

While There are tons of post or cheatsheets on firefox shortcuts, this post will just cover the essentials. These are the shortcuts that you actually need to know to increase your productivity. We will explore some of the less known tools like

  • Caret Browsing
  • Page Info
  • Open Address Bar Link in New Tab
  • Tab Navigation using KeyBoard


Note:This article has been written for linux. So if you are using windows just note that super means start button. And not all the shortcuts might be applicable to you. I would still suggest you read it since most of them would be applicable. You will definitely learn a new thing or two.

Let's get going with firstly the File Menu

File Menu

  1. New Window: Ctrl + N
  2. Private Window: Ctrl+ Shift + P
  3. Save a Page : Ctrl +S
  4. Print a Page : Ctrl + P
Most of the people should be familiar with New Tab , New Window and Printing a Page. In case, you are not, no worries, just go ahead and press the shortcut keys to get an idea. We will look a bit into the Private Window and Saving a Page.

Private Window

This opens a window similar to the New Window option but with one major difference. It doesn't remember your history. This particularly great when logging in accounts for one-time access. No browsing history , cookies and sessions are stored. Also FireFox comes with this legendary Do Not Track Me features, which means while you are using Private Browsing all tracking by websites should be rendered useless. 

Note: Private Browsing does not increase security in any way. You are still vulnerable to security threats.

Save a Page

This allows you to save a page to view it offline. You can carry it on your pendrive. Whenever you want to open it just open it by double clicking it. You can use another browser to open the website. All images and css files or script files are stored in a separate folder called website_name_files. This is almost as good as making a page rip.

Thursday, 9 February 2017

Multi-Threaded Echo Server in Java

Implement a Multi-threading application for echo server using socket programming in JAVA.

Implementation


Server Side

  1. Create a Server Class implementing the Runnable interface
  2. In the run method, create a data input and output stream with a client.
  3. In the main method write code to create a ServerSocket at a give port.
  4. Create a infinite loop, to accept server connection from clients and launch a thread.
  5. In the thread, when we catch an IOException we use return to quit. IOException occurs when the pipe is broken, that is, the client leaves.
  6. Additionally we have give id's to identify when a client joined and left.
Client Side
  1. Establish connection with server
  2. Create Input and output streams for interacting with the server
  3. Create a infinite loop to send messages to echo server
  4. Quit the loop on get quit as an input.

Monday, 6 February 2017

MultiThreaded Calculator in Lisp

Implement an calculator (64 bit Binary Multiplication) application using concurrent lisp.

Before we get to the Implementation of the Program, get your Lisp Programing Environment Setup. In case you haven't yet set it up , here's an article about the same.

Implementation


We have created a text based interface for the calculator which accepts two numbers. The result of addition , subtraction , multiplication and division in calculated.

Input: Accepted in binary
Output: Displayed in binary

Functions
4 Lamda Function to compute each of the operations
btd: This function is for binary to decimal. Converts a binary to decimal


Code


Wednesday, 1 February 2017

Finding Java Home in Ubuntu

Often Ubuntu Users struggle with setting up of Apache Tomcat, Hadoop and other Java Technologies.

The reason being Java Home Error.

It is Either not set or incorrectly set due to mismatch in the java variant.

Java Variants

The java installation in Ubuntu comes in two ways

  1. Open Jdk
  2. Sun/Oracle Jdk
Always use the second one if you are working with android.

The Fix



The easiest way to fix this is to use the update-java-alternatives command

sudo update-java-alternatives -l

This will give you the java home.

Use this to java home in your config File.

Whenever updating apend a /jre at the end.

Screenshot


how to find java home ubuntu
update-java-alternatives
Example in this case value for Java_Home will be
/usr/lib/jvm/java-8-oracle/jre