Monday, December 10, 2018

Mobile Usage hitting Code Quality


You might be thinking how can mobile usage hit code quality. How can these two be related ? As you read through this blog you would be convinced the title is very true.

Mobile has come a long way in the past decade or two. Now with the Data being very cheap and everyone having the Smartest phones all of us have access to complete internet and entertainment all the time. While it has it own perks it also has its own disadvantage.

According to stats in statista the time spend by Millennial has more than doubled from 2012 to 2017. Millennials spend around 223 minutes per day on Mobile which is around 4 hours.



Out of those four hours which is spend on mobile every day how many hours or minutes do you think we spend during work hours ? It could range from person to person but you get the picture.

Now you might be thinking of the counter argument for spending time on phone during Work. For engineers the best excuse is code was getting compiled so just though of checking my phone. While this excuse might feel apt at first but it is quite detrimental to code Quality.  These are few of things that can go wrong:

  • Taking time away from Thinking about the code : By checking your phone in between coding you are taking away time from thinking about the code. While a engineer is coding he/she has to build the complete architecture of the code in their mind. It is like build a castle in mind. While he/she is in the process of building the castle checking phone can cause the castle to collapse and the whole process has to done all over again. This-is-why-you-shouldnt-interrupt-a-programmer aptly describe what happens when you interrupt a programmer. Not only it is external disturbance our mobile also distract us by showing a message from a friend or a new Facebook story that a friend has added.
  • Mistakes during coding : As we get distracted while coding there are high chances that the programmer does not think through all the scenarios. This causes bugs to be seeded in the code and it requires rework. All of us very well know the cost of fixing a bug. And if the bug is leaked to the clients then it takes the company a lot of money and resource to fix it.
  • Innovative ways to Solve the Problem : To think of new ways to solve the problem or getting the performance of the existing code up programmer requires the mind to be free of distraction. Mobile are a easy source to create this distraction which can deprive the clients from having high performing code.

So now you might be thinking should I not use my mobile at all during work ? No I am not suggesting that. Mobile has become integral part of our life's and I know its not possible to live without that.

Check your mobiles only during the breaks. Go way from your desk while you are checking your mobile or talking to friend or texting someone. This would help you judge how long you were on your mobile. There are apps now which can tell you how many hours you spend on the mobile on different apps. Use the apps to get a time spent on the mobile.

You can also turn off Data from your mobile which would stop unnecessary messages and notifications coming on your mobile. If it is anything urgent other would call you.

Mobile could be the only thing standing between you bringing the next big innovation for Clients.

With that I leave you with a quote by Robert C Martin -
Clean code is not written by following a set of rules. You don’t become a software craftsman by learning a list of heuristics. Professionalism and craftsmanship come from values that drive disciplines.” 


Tuesday, March 22, 2016

Java Interview Preparation Links


Different Java Versions and Important Features

https://ondro.inginea.eu/index.php/new-features-in-java-versions-since-java-8/


Java Links

Exception handling

Interview Questions

Java Strings

Collections


Design Pattern


OOPS Concepts

Generics In Java

Threads
Executor,Executor Service


Frameworks

Friday, June 13, 2014

Git Basic Commands


Set user.name and user.email in config file

$ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com

See the config setting in your git

$ git config --list user.name=Scott Chacon user.email=schacon@gmail.com color.status=auto color.branch=auto color.interactive=auto color.diff=auto ...

Getting Help

$ git help $ git --help $ man git-

Initializing a repository

$ git init

Add a file to the repository

$ git add *.c 
OR $ git add README

Clone a repository

$ git clone git://github.com/schacon/grit.git
OR
$ git clone https://github.com/schacon/grit.git


Clone a repository in a particular folder

$ git clone https://github.com/schacon/grit.git mygrit

Check status of the files

$ git status

Checkout a branch

$ git checkout

Checkout and create a branch

$ git checkout -b

Commit the changes

$ git commit -m "comment"

Push the changes to the branch

$ git push origin

See the logs

$ git log

git

git


References:








Tuesday, June 10, 2014

Find if the port is already in use in Windows

In the command prompt use the following command to find if a port is already in use:

C:\Users\username>netstat -an |find /i "2990"

Tuesday, April 8, 2014

Convert Input Stream to ByteArray

Converting the Input Stream to Byte Array is very simple. You can org.apache.commons.io.IOUtils to get the job done quickly.

The IOUtils contains a method toByteArray which takes in a InputStream and converts the input stream into a byte Array.


byte[] byteArray = IOUtils.toByteArray(in);

How to change Byte array byte[] to InputStream



The byte array can be converted into the input stream using the java.io.ByteArrayInputStream class. The ByteArrayInputStream class extends the InputStream class.

In the constructor of the ByteArrayInputStream just pass the byte array (byte[]) which you want to convert into InputStream.

InputStream stream = new ByteArrayInputStream(myBytes);

Friday, March 21, 2014

Remote X11 Over SSH

Remote X11 Over SSH

On the remote machine (Linux):
1) Ensure that X11Forwarding is enabled in /etc/ssh/sshd_conf on the remote machine.

On the local machine (Windows):
2) Install Xming.
 3) Add the Linux machine's DNS name(s) and IP address to the C:\Program Files\xming\X0.hosts file. File should containthe IP of the server for which you want X11 forwarding:
   localhost
   192.168.1.25
4) Start Xming on your Windows machine (NOT XLaunch)
5) Install SSH Secure Shell(if it's not already installed) onto your Windows machine.
6) Open ssh client and fill in the “Host Name” box.
7) Ensure the port is correct (probably 22).
8) Under Settings > Tunneling > X11 check the “Tunnel X11 connections” box.
9) If you create a profile then ensure tunneling is enabled on the profile as well.
10) Start the connection.
11) Log into the remote machine as you would do in a normal SSH session.
12) Start the X application from the command line, a window should open on your local machine with the application.
13) Minimize the SSH session, do not close it. If you close it, your X connections will close.
(It's a regular SSH session with putty but with X11 forwarding enabled.)

*The steps are pretty much the same for putty as well. you just need to switch on X11 forwarding in putty.

1) Open putty and fill in the “Host Name” box.
2) Ensure that SSH is checked and that the port is correct (probably 22).
3) Under Category > Connection > SSH > X11 check the “Enable X11 forwarding” box.
4) Click the “Open” button to start the connection.
5) Log into the remote machine as you would do in a normal SSH session.
6) Start the X application from the command line, a window should open on your local machine with the application.
7) Minimize the SSH session, do not close it. If you close it, your X connections will close.
(It's a regular SSH session with putty but with X11 forwarding enabled.)