Translate

Tuesday, 25 October 2016

Spend time with the best person on this earth - YOU

It we are not with others, we are texting, phoning, emailing but spending some time with yourself can reap enormous benefits.

In this pro-social world we are strongly influenced in favor of being with people, or at least constantly interacting with others, be it through social media or other electronic means. We are always going somewhere, doing something or at least chatting to someone about going somewhere or doing something.

What if you stepped away from all of that and took some time just to be alone? Took time to just do your own thing, on your own and in your own way?

Here are 10 benefits of spending time alone:

1) There is no pressure as to how well you perform.

When you are alone you can take time to become involved in activities that you really enjoy with no pressure as to how well you perform them or how accomplished you are.

The joy is in the doing, in the experiencing and in your own inner enjoyment of expressing yourself.


2) Your unique brand of creativity flourishes.

Your unique brand of creativity flourishes when you are removed from outside influences.

If you want to paint your house, paint a picture, design something, write something, invent something, spend quiet time allowing your imaginative genius freedom to explore possibilities. It can be a most rewarding experience. Explore your abilities and interests. You may come up with something that will change your life.


3) Gear down, refresh and get ready to tackle the world.

We live in a very hectic society. Stress and stress related illness is at an all-time high. Spending time on your own allows you to gear down, refresh and be more ready to tackle the outside world when you re-emerge.


4) Quiet time can help you sort through problems.

Just sitting down and thinking through a problem, thinking about what caused it and how best to resolve it can result in very effective solutions. But even if a solution is not forthcoming, just having taken the time to think things through and to understand the problem more thoroughly can bring peace and a certain courage to carry on.


5) Get a better understanding of yourself.

Do you truly know yourself? Do you feel you really understand who you are?

Most people do not. While spending more time alone may not bring you the complete answer to this question, it can certainly give you a much better understanding of how you truly feel about things going on in your life.

You can discover more of your abilities, your passions, your interests and even your dislikes. You get a feel for yourself, who you are and where you fit in the world. This brings self-confidence.


6) You may find a new best friend.

Contentment with life is strongly based on contentment with who you are. If you spend time alone, you find out more about yourself.

If you really dig down and get to know yourself thoroughly, and to enjoy who you are, your interactions with the world will work out better too because when you know and like who you are as a person it shows through everything you do and say. It is a very attractive quality.


7) Get more done.

Do you have a list of things you need to do, want to do? Is your list one of these that never seems to get any shorter because you are always too busy to get around to doing the things on the list?

Spending time on your own will allow you uninterrupted time to get these things done. You may or may not enjoy doing them, depending on what is on your list, but you will definitely feel better for having finished them. You will emerge with less stress, less weighing on your mind and the satisfaction of a job well done.


8) Become more relaxed and tolerant.

Do you sometimes feel irritable and get easily annoyed with people? Do you find a great many “jerks” around you at times?

The more annoying people appear to you, and more of them there are, the more you could benefit from some time on your own. You cannot change the world, you cannot change what other people say or do. But you can change your perspective on them. After some calm, peaceful time on your own doing whatever pleases you, or doing nothing at all, you will find the annoyances in life shrink dramatically because you are now relaxed and more tolerant.


9) Explore the possibilities for your life.

You can explore the possibilities for your life. What would you like to achieve or do? How can you go about it? What do you need to do to be able to start? Think things through. Allow your mind to wander. Do not relegate anything as impossible.

Just keep on thinking about what would give you the most satisfaction, the most joy. What is that? Take time alone to look inside and ponder on what would make your life the most worth living, both for yourself and for those you love. It may be something that comes through your work or not. The important thing is that it is what brings you joy and engages your passion.


10) Enjoy time with someone awesome.

And lastly, it is a great idea to spend time on your own because you are awesome and spending time with someone awesome is a wonderful, exhilarating, amazing thing to be able to do. Spend time alone and celebrate you.


Time by yourself can benefit you in so many ways plus making the time you spend with others more enjoyable as a result of being more in tune with yourself and more relaxed. What would you enjoy doing on your own?

Monday, 15 June 2015

How To become a better Programmer (coder)







import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;


public class CSV {
static{
//Class.forName("");
}

public static void main(String[] args) throws IOException, SQLException {
BufferedReader br = new BufferedReader(new FileReader(""));
int n = 1000;
String current;
ArrayList arr = new ArrayList();
ArrayList endRes = new ArrayList<String>();
while((current=br.readLine())!=null){
arr.add(current);
for(int i=0;i<n-1;i++){
String current2 = br.readLine();
if(current2!=null){
arr.add(current2);
}
else{
break;
}
}
// TODO
// SQL with the help of arr
arr.toString().substring(1,arr.size()-2);
Connection con = null;
PreparedStatement st = con.prepareStatement("Select * from table where userId in ?");
ResultSet rs = st.executeQuery();
con.close();
while(rs.next()){
String value = rs.getString("Coloumn  name");
String value2 = rs.getString("Coloumn  name");
String finalStr = value+"-"+value2;
endRes.add(finalStr);
}
//Write to file endRes
arr.clear();
}
}

}








Today's era is full of language expert than real programmers. It's easy to understand keywords, methods and API of Java programming language, but same time it's difficult to solve a real problems, design reusable and robust software and get maximum of data structure and algorithm. I have often seen Java programmers not doing so well when asked to design and code a solution in limited time, but same time they are really good with Java concepts and all theory. Even senior programmers of 4 to 6 years experience in Java programming, sometime fail to solve questions like designingcoffee-maker, coding Vending Machine or sometime even recursively reversing a linked list. I may be just moving off from becoming better programmer, but it's important to know your limitation and then work out to resolve those. If you feel resistance in coding, then you should code as much as possible, if you feel stressed and lost in designing using Object oriented analysis and design, then you should do designing using pen and paper as much as possible. This resistance is what actually preventing you from being a better programmer. I have personally found that coding and designing presents lot of resistance to an average programmer, because in most of them in their professional job don't do enough coding and development. By the way, there could be numerous tips to become better programmer, I will stick with my list, which I personally follow and which has continuously helped me.



10 Tips to Improve Programming Skill and Become Better Programmer

In order to become a better programmer, you need to be really good at data structure, algorithms, designing using OOPS, multi-threading and various programming concept e.g. recursion,divide and conquer, prototyping, and unit testing. Programming is a combination of many skills, which means it's not possible to learn it in quick time, rather it will come with time and experience, but that won't happen automatically. You can spend 5 years doing a Java programming job, without being a good programmer. Since most of Java interviews focus on theory rather than programming and coding skills. Not many programmers practice these essential programming skills. If there is a mandatory problem solving programming test, I would bet, average programmer would have been much better. Any way, here is my list of things, which can help you to become a good programmer.


1) Coding, Coding and Coding
Why I have coding at top of this list? because it's difficult and same time it's central piece of programming. By doing coding, you also realize your mistakes in designing, error handling, threading and then go back to those respective skill to improve. You just can not work in designing only, coding produce output, which is important to learn and act as success. By the way, do not stop just after solving the problem, it's always better to throw away your first solution, that is just a prototype, your next solution should address issues, missing requirements which you have found building prototype.


2) Reading Books
Coding is easier said than done, and there is huge difference between good code and bad code, but how do you know? Until you have seen a good code, and know why a particular code is good, you can not understand difference. This is where books comes to help, more often than not authors are great programmers themselves. They offers their experience in form of book. I love books, but one book, which is particularly helped me is Clean Code by Uncle Bob. By reading this book, I have found myself finding problems in my code and applying advice given in this book every now and then. My advice is if you ever find such books, grab them. I also recommend reading this classic books many times, and refer them every now and then. Another similar book is Effective Java by Joshua Bloch, which is full of good advise. It's also from of my list of  must read books for Java programmer. Also, by reading books you are learning from someone else's experience, and there is only two ways to improve yourself, either by learning from own experience (which is very limited) orlearning from others experience (which is unlimited). Remember more is not always good, rather than reading 5 books, I suggest read two book, which you enjoyed reading multiple times.


3) Contributing to Open Source, Signing-up mailing lists
Contributing on Open source code, especially from Apache, Google and some other projects is another way to improve your programming skill and become a better programmer. Just signing there mailing list and following discussion teaches you a lot. Since most of discussions happens between good programmers, by listening them and understanding problem and their approach, solution and view, automatically develop good programming habits on you. To get most of it, do not just sit passive, ask questions, offer your view, but same time value others as well.


4) Practicing data structure, Algorithms and Design related problems
I was thinking to put that as second item, but it ended up fourth. In my opinion this is the most critical of things to do to become a better programmer. Most of good programmers I have seen and met are really good in data structures, algorithms and basics. By learning these things, you take better advantage of what is available. Since data structure is key piece of any program, solid knowledge of them helps during problem solving. Similarly knowledge of key programming principles, search and sort algorithms and other well know algorithms develop programming skills on you.


5) Reading Good Blogs
Reading good blogs is a small part of reading books. How does reading blogs helps you to become better programmer? Well it does. Since blogs are often written by programmer themselves and most of them share there personal view, experience, you often find them relevant. Also blogs  are small  piece of information so it digests well. Blog also help to learn new technology and new features of existing language and API. Many times, I have seen something subtle, or missed things from a really well known part of Java described in a small blog post.


6) Reading Code
If reading blogs helps to become good programmer, than reading code help more than that, but same time reading blog is easy but reading code is tough. Do you see resistance? then you should do it. Look code of open source projects, your fellow programmers code, your existing proprietary code, code from Java SDK and try to understand how they work, try to see what they are doing and why they are doing. Find patterns, develop navigation skill, initially you will find it boring and difficult, but with time you will develop a good code sense, which will alert you when you do mistake, help you to spot others mistake, gaps and code smell. This Code sense is one of the sign of better programmer, they often tend to look, what you missed.


7) Writing Unit test
Unit test complement thinking and coding process, and subsequently helps you to design better. Anything which is difficult to test has chance of improvement. Also writing unit test helps a lot in finding better names, better abstraction, better interface and abstract class design and overall improves code quality. But like coding and designing, unit testing is also tough job for average programmers, you will see lot of resistance there. Some programmer writes trivial test, instead of thinking hard on usage scenario. Remember there is no substitute of think through process, after analysis, design and development, unit testing is another opportunity to think through scenarios and gaps in your code. Make it a rule, always write Unit test for your code.


8) Doing Code review
Like Unit testing, Code review is another thing which help to become a good solid programmer. Code review help both reviewer and author, reviewer improves his code sense and offer genuine advice, while author learn from his mistakes. It often helps that the code you think is rock solid, has some bugs which only other programmer can see, Code review and four eye check does that for you. If you are lucky and get a chance to work in a company which has unit testing, code review as discipline then you are likely to be  better programmer than rest. These two things immensely help to improve programming skill.


9) Talking to fellow programmer
Reading is passive event compared to talking. Talking a program and discussing that with fellow programmer, often leads in better solution, it's natural because your mind tends to involve more, whey you talk and listen to other. I have then found gaps, missing requirements, bugs and design flaws while discussing with team mates. In software industry, where programmers tends to isolate them with there computer, talking, sharing and doing white board sessions helps immensely. Don't just sit and code, talk, listen and think and hangout with fellow programmers. participating on event also helps.


10) Participating Stack Overflow and forums, Commenting in Blogs
This is another form of activity, which helps to revise knowledge. By sharing knowledge, first person who benefits is the one who share. Since programming is big and vast, you tend to forget most of things which you don't use for more than 3 months. Participating inStackOverflow and answering others queries, commenting on blogs and forums is a nice little way to revise knowledge and same time correct your misconception. By putting our knowledge in front of others, we not only helps others but also put them into test. Many times you will see, someone benefiting from your knowledge but also you are getting your misconception corrected.


Every programmer wants to become better programmer, but not every one succeeds. Apart from natural talent of programming and problem solving, it requires lot of hard work, constant learning and perseverance to become a better programmer. The more you do real work e.g. Coding, Designing, Unit Testing and Code review, the more better you will become. If you just want to do one thing at this moment, I would say go and read clean code.
Alok yadav

Tuesday, 7 April 2015

Be positive in thoughts and actions, world will be yours :)

How to Be Positive in Thoughts and Actions

By Alok yadav
Do you sometimes wonder how to be positive in your thoughts and actions, especially when you are unhappy and unsatisfied, or when life is difficult and tough? For many, it is difficult to be positive, even when things go well.
Though it's so simple, most people don't know how to be positive. Sometimes, they prefer to stay negative, because it is a more familiar state of mind.
Like every other subject, the know-how of how to be positive can be learned and the skill developed. It has much to do with changing your attitude and your mindset.
If you keep thinking the same thoughts, day and night, they might, sooner or later, manifest in your world, becoming your reality. This means that if you want your life to be as you want it to be, you have to be careful of what you think. You need to start thinking more positively.

Your Mind Creates Your Reality

As you think, so your life becomes. Changing your attitude and expectations, will sooner or later, change your life accordingly.
It is your mind that creates the kind of life you live. If you think positively, you will transform your life accordingly. Everything starts from within, from the most simple action, to the greatest achievement.
We cannot always control our external circumstances, but we can control our inner world of thoughts, where everything begins. We cannot always control our outer universe, but we can, with some effort, control our inner universe.
If you are unhappy and negative, you can change the way you feel and think.
With a little work and effort, you can change your attitude, expectations, actions and reactions, and this will lead to more motivation, happiness, and improved life conditions.

How to Be Positive

  1. Substitute your negative thoughts with positive ones. Substitute thoughts about poverty, with thoughts about wealth, weakness with strength, lack of self esteem with self esteem, disharmony with harmony. Whenever you catch yourself thinking negatively, fill your mind with opposite thoughts, of happiness and success.
  2. Focus on what you want, not on what you don't want.
  3. Focus your mind on the good things you already have in your life. This will cause them to increase in your life.
  4. Do not fill your mind with thoughts of lack. Think and believe that you already have abundance, success, love and happiness.
  5. Learn to feel, think and even act, as if you are already living the life you want. If you can feel, think and act consistently in this way, you will become happier, and will attract new opportunities into your life.
  6. Think about what you want, create a picture of it in your mind, and make it very clear and precise. Hold it there and focus on it in a positive way, until it becomes a reality in your life.
  7. Always tell yourself, "I can", "I am able", "I can do it".
  8. Often, during the day, repeat positive affirmations about what you want. Do so with faith, feelings, intention and focus.
  9. Look for the good in every situation. There is always something good, or at least something useful to learn, even in difficult or unpleasant situations.
  10. Follow your positive thoughts with positive actions. It is not enough to think, you also need to act to make things happen.
  11. Always focus your mind on the full half of the cup, not on the empty half.
  12. Be aware of your company. Choose to be around positive people.
  13. Read about other people's success. Read things that inspire you and make you feel good.
  14. Focus your mind on how to be positive and you will discover more ways to be so.
We get what we expect to get. Therefore, begin right now to expect the very best of everything that this world has to offer, and wish the same for everyone else. There is plenty of everything in the Universe for everyone, and the Universe can create more of the good things for everyone.
Don't think lack, think abundance, for you and for everyone else.

Monday, 6 April 2015

iOS – File Sharing Using WiFi

Objective: The main objective of this post is to describe how to share file between two apple devices using WiFi. In following demo I have described how to connect two devices using WiFi and then share large size image file by dividing it in data chunks and save shared file in camera roll of other device.
Note : To connect devices and share file application must be installed in both devices.
* Turn Off bluetooth while WiFi sharing, as it will interfere WiFi.
  • iOS – File Sharing Using WiFi
Step 1: Create new XCode project name it as FileShareDemo. It contains one UIViewController Main.storyboard file.
Step 2: Add two UIButton in UIVIewController and set title “Connect” and “Share” respectively in both UIButton.
Step 3: Add MultipeerConnectivity framework in your project. Also add .png file which you want to share.
Step 4: In ViewController.h file you have to import MultipeerConnectivity framework, set delegate and declare property as below.
Step 5: Initialize both NSMutableArray object in viewDidLoad method.
Step 6: Initialize MCSession object, MCBrowserViewController object, and MCPeerID object in setUpMultipeer method.
Also implement below methods in your ViewController.m file.
Step 6: Call setUpMultipeer and showBrowserVC methods from connect button action method.
Step 7: Implement MCBrowserViewControllerDelegate methods.
Step 7: Now in sendData method divide your image in data chunks and call sendData:toPeers:withMode :error method of MCSession object and pass data chunk in it to connected peer.
Step 9: Call sendData method from send button action method.
Step 8: Add appendFileData method to append all chunks and save file on receiver device and display alert message after image saved successfully in camera roll.
Step 9: Add MCSessionDelegate methods.