In the previous post we have seen that how we can revert or undo a local or public git commit using git revert. In this post we are going to see some other ways in which we can Revert or Undo a commit using git. Yes, you have read it right only we are talking about only local commit.
Note : There are lot of things in life and git can’t be undone always .
Undo a commit using git amend :
Let’s consider a scenario where you have just started development of your application , and now you have lot of files to checkin into the git repository so for doing that you have to do a local commit first, of all those files. After doing this commit you have realized that , few files have been missed that was also supposed to go in the same commit or you just want to change the commit message only .Constraint is that all these changes should belong to a single commit and not to multiple commits. You can achieve the same by using git commit with amend.
Let’s understand the whole process step by step.
First I have changed two files file1.txt and file2.txt in my system , as you can see the same with git status.
Now I have made a commit in which I have intentionally missed out 2nd file.
git commit –m “Intentionally missing file2 in the commit” file1.txt
After that I executed git log to confirm that my commit is successfully registered.
Continue reading →
If you have missed out my previous posts on git repositories then you can read it here.
While working on GIT distributed version control system , you might have found yourself in a scenario where you have to revert or undo last git commit. Reason for revert can be anything like wrong file checked in , some junk code has been checked in that can impact your well developed application etc.
Now here two scenario exists depends on the level of your commit–
1. If the commit has been already pushed to central remote repository that means now it is a public commit that means other developers can see these changes.
2. Commit is only made in your local cloned repository and push is pending that means it is a local commit that means nobody can see these changes except you.
Here , we will see the all the possible ways in which we can revert or undo a local commit and a public commit.
For better demonstration we will see it with the help of an example :-
I have cloned a remote repository into my local system and I made a local commit that I was not supposed to make. So, when I did git status it showed me the file that I edited by mistake and committed it in image 1 and image 2 respectively. And after executing git log you can see the that our previous commit is successfully registered(image 3).
Now after doing commit I realized that there is a problem with my commit and I have to revert it immediately. For undoing or revert the commit ,git provides multiple solutions.
Solution 1 : Change all the files with the opposite changes that you made in previous commit and make one more new commit . This is most straightforward and conventional way of doing this , if you are a git beginner and not very familiar with the git commands then this is for you.
Solution 2 : You can execute the Continue reading →
If you have missed my previous post on maven basic terminologies then you can read it here . In this post we will roam around Maven Central Repository, how they work , what are their significance in Maven, How you can customize Maven Repositories and lot of other things about maven repositories.
What is a Maven Repository:
When you invoke maven reactor for the first time by calling any maven build life cycle , goal , plugin etc , you might have noticed that maven started downloading a lot of files from a url , these files are nothing but the artifacts and plugins that are required to complete the build, and here the url refers to a location where all these files (artifacts and plugins) are present.
By default maven shipped with a default remote repository location i.e http://central.maven.org/maven2/ and from here it tries to download all the files and then it will store it into your local maven repository. The advantage of storing it in a local repository is , when the next time you build your maven project it don’t have to go to remote repository for downloading the files as it will be available in your local repo , hence it will use it from local system.
Standard location of this maven local repository varies with the underlying operating system Continue reading →
In this post we are going to see the definition and usage of some important terms in Apache Maven framework. Before going into the depth of maven it is very important to understand the essence of these terms. So , let’s begin
1. What is Maven : – There is a misconception among many people about What exactly Maven is ? and What it do ? . Some people say that , it is a build tool used to generate artifacts in the form of jar, war and ear file from your source code , other group of developers say that it is a Project Management Tool that has a Project Object Model (pom file) , a standard life cycle , executing different goals at different phase in the life cycle , do the dependency management etc . Actually both of them are correct , Maven is much more than a traditional build tool . How ?? We will see that in just a minute.
Maven strictly believes in the policy of “Configuration over Convention” that says Continue reading →
Today after reaching office the first thing that I heard from my manager is that – we are getting deployment exception , can you please look into this . I was not expecting this as my expectation was as usual he will say good morning , but this day has something else for me in the core and overall it was an interesting day at least learnt something new J .
Before we go into the detail of the problem I want to tell you root cause of that – Maven Dependency Version Conflicts. In our application we were having the multiple versions of spring-expression jars which were brought in by Continue reading →
In this post we are going to see 6 different ways by which we can find HTTP request source .
These days whenever we develop an application , our target is that it should be accessible from both computers and mobile devices so that an end-user can access the application wherever he wants and whenever he wants. So, when we target audience from the both these channels there is always a challenge that exist for a developer to identify a request source whether it is coming from a computer , mobile device or tablet . I am saying this as a challenge only on the basis of request source content will be rendered on the user system whether its computer, mobile device or a tablet by applying the different resolution policy , css , scripts anything that will execute on client side. Even after this there is one more challenge to find out the device type whether its Android ,Apple , Black Berry or Windows.
From here we will see all the ways by which we can find HTTP request source .So, for this now you have two options either you can handle this thing on Server Side Code or Client Side Code, we will see solutions on both side.
1. Server Side (Using Java) –
If you want to handle this thing on server-side then you can use the following class UAgentInfo.java .
It is an open source project developed by MobileESP and it provides you very granular level details of each and every type even more latest operating system one like Tigen ,Meego and Windows 8. For more reference you can visit here.
2. Server Side (Using PHP) –
If PHP is your cup of tea and you want to handle this on server side only then MobileESP also provides you API for that. Here you will have a server file mdetect.php that you can use internally in your application for identifying source of request. You can find the file here.
It also covers all the device type , operating system types that its counter part java class supports.
Same server side APIs are also available for ASP.NET and python. You can follow the links here ASP.NET and Python.
Continue reading →
This post will focus on the Difference between 32 bit and 64 bit JVM and which one to choose in a situation.
Today while deploying my application I was getting a very familiar exception that is related to the heap size.
Exception occurred during event dispatching:
java.lang.OutOfMemoryError: Java heap space
After looking at the exception I was very happy that I will fix it in few minutes, so for doing that I increased my heap size to 1024M and restarted my servers. The result was totally unexpected and it failed again with the same error , after this I slowly increased it by 1280 , 1372 and then 1536M but the result was same. Now at this point I was sure that there is something wrong happening that is beyond of my control and I have to look at the specs. At this point I was sure that there is something wrong at JVM level , so I started looking into details over the internet and after that I was able to successfully resolve my problem.
Here I am going to put my findings whatever I gathered on 32 Vs 64 bit JVM over the internet.
What 32 and 64 bit means ? :
If we look at the basic definition of 32 vs 64 bit , then it simply means how much data can be operated at an instance , in case of 32 bit system it utilizes the data in 32 pieces and in case of 64 bit system in 64 pieces. This difference exists at both hardware and software level as in 64 bit system you will have bigger data paths that will process the data much faster in comparison to 32 bit system. On the software side in 64 bit systems you will have new instructions , opcodes that can simulate with above components. Continue reading →
After starting my wordpress blog ,within few days some of posts starts toping the Google chart , I was very happy by seeing that but it caused an unwanted problem for me i.e I started getting spam emails and spam comments on my posts.On an average I was getting 50-100 spams everyday and I was really pissed of these spams , so I thought instead of running away from them I have to fight with these spams.So next question is How to fight spams, In this post I am going to focus on what all measures I have taken to avoid spams and gave a rock solid answer to these spammers.
Below are the steps that I have taken(and you can also ) to combat with these spams .
- Akismet : I am sure that whoever belongs to blogging world and more specifically who have their blog hosted on the wordpress platform is aware of what Akismet do. Akismet is wordpress plugin and has been installed by default when you move your blog on wordpress platform. So, whenever anybody commented on your posts / articles , it never get published automatically , it always comes to you for moderation where you can decide to approve , delete or mark it as spam. So, Akismet is providing you basic level of shield against these spams but it always requires manual intervention from your Continue reading →
Since 2009 , Google reduced the weighing of meta tags while giving ratings for web pages or more precisely we can say it ignored meta tags completely while ranking the pages in SERPs ,so that does not mean that you also start ignoring them because it directly impacts search engine optimization for your website.
If you are not aware of the basics of what are meta tags and why they are important , then I think you are missing one of the key aspects of Search Engine Optimization – SEO and more importantly it will help your readers to understand , what your website is about or what your post is about ?
So, let’s start looking into the details of meta tags and how they are important.
If you are little bit aware of how HTML source code looks like , then you might know every HTML document has a <head> tag in it , where you define the meta data about that site , best example is “Title of any site”. Meta tags are also present inside the <head> tag but they have their own significance because earlier they were used by search engines in deciding the ranking of any web page. But after people started abusing these meta tags , most of the search engines start ignoring them. Now let’s look into the important components of meta tags.
Meta tags has been divided into three categories:
Note: There are other types of meta tags also Continue reading →
Today when I was looking at my site traffic stats , I seen that there are some of them belongs to web spider, bot , robot etc. Below is a snapshot of what I have seen there related to web spiders.
So, this thing increased my curiosity and I started looking into what are web spiders , web crawlers , robots , bots and how all these things work ?.
One interesting thing that I found about all the above mentioned terms that, they all are same only difference is that different people use different terminology to explain the things. So for rest of the post I am going to use the term Web Spider.
What is Web Spider ?
Let’s try to understand this thing from the other direction, whenever you do a search on any search engine it shows you the best results on the basis of your provided input. To fetch this result it is required for search engines that they are already storing this information somewhere and whenever anybody asks for this information they consult to some program and return you the best results.
So, that someone who is helping search engines in finding the information that you requested from millions of pages are known as “Web Spiders or Web Crawlers”.