Adds

Saturday, April 27, 2019

How to move a branch into master ( GIT )



From time to time when developing, you can create a branch and work in that branch for a little too long.
It may be desirable to move all that code back to the master branch:

git checkout branchtoBeMoved
git merge -s ours master
git checkout master
git merge branchtoBeMoved

Explanation:
git checkout branchtoBeMoved   - change to the branch we want to move to master
git merge -s ours master –( merge documentation ) we are merging master to the branchtoBeMoved , the specified strategy (-s ours) means that we are always going to favor branchtoBemoved when merging (as we are in that branch at the moment)
git checkout master – change to the master branch
git merge branchtoBemoved – merge code into master

Friday, March 16, 2018

This is a Simple and Short GIT tutorial for beginners.




After installing GIT on your local machine, you should set up your identity (global not per repository):
git config --global user.name "Your Name"
git config --global user.email yname@email.com
to check your identity setting use:
git config user.name
git config user.email
To create new Local repository :
git init
which will create git repository in the current directory, or 
git init <project directory>
which will create git repository in the requested directory.
At any time to see the current state of repository use:
git status
Now we need to add all the existing code in the directory to the newly created repository:
git add *
or 
git add file1 file2 file3
to see what is in the staging area (about to be committed)
git diff --cached
or as discussed above 
git status
Which moves the code to the staging area (where we group items we want to commit). To commit those items:
git commit -m “commit message”
you can again check the status of the repository with 
git status
also, a useful command that shows the committed changes is:
git log
To see history of specific file 
git log file1
To see a graph representation of data
git log --graph --decorate --oneline
To check out code from remote location to your local repository:
git clone URL
Or 
git clone username@host:URL
To pull changes from remote repository to your local:
git pull
to push your local repository to master (remote)
git push origin master
to list branches:
git branch
to create new branch and switch to it
git checkout -b branchname
to switch to another branch
git checkout branchname
 
 
 
 
 
 
 
 
 



Tuesday, October 25, 2016

Advice for successful developer interview



Are you going to programmer/developer interviews and not getting anywhere? Maybe you are not approaching it in the right way. After being involved in hiring process few times I decided to write down some concrete advice.




  •          Be able to talk about SOMETHING you did related to programing/development
  •          Have an answer to a questions what you are working on now.
  •          Gain some experience with at least one software repository (SVN, GIT etc.)
  •          Do know how to write a simple SQL query.
  •          Do know how to write programs to solve simple problems (remember most of those questions can be coded in 5 minutes, so the list of potential questions is not really that big).
  •          When doing a coding potion of interview Do explain what you doing/thinking.

If looking at the above list you see something you are not comfortable with, spend some time looking into that (and if you have a comment please add this to this short post).


Monday, June 8, 2015

Simple way to create WSDL contract by hand.




Simple way to  create WSDL contract by hand...

 
Almost everyone agrees that SOAP webservices should be created contract first. One of the main arguments for not using contract first (WSDL first) web service development is that it requires the programmer to learn new technology. This post will try to explain the process of creating a WSDL contract by hand. In later posts I will explain how to use that WSDL to create Java (CXF) and .Net (WCF) based solutions (both server and client side).  

Developing WSDL can be done in few simple steps:

  •   Design basic objects (create XSD). 
  •   Design basic methods (create XSD). 
  •   Create WSDL file.


 Before creating a web service it is good to know what that web service should do.
In this example we will create a contract (WSDL) that will save a document and the information about document's author to the backend
.
Before we start writing xsd lets agree on fields:

  • docImage – will be the actual PDF document
  • docTitle – will be the title of the document
  • docAuthor – will be the author of the document
  • docFiledDate – will be the date the document was filed ( not submitted by user, the date is set by server upon receiving the document.


So the docImage will be a binary file (PDF for example), docTitle a string, docAuthor an object etc.
First we will need to create a types file. This will be a file where we will define basic objects that will be used by our web services (below code from file Types_V_1.xsd):


Above we just defined fields that will be sent from or to server.
So now that we did the hardest part of the work the cookie-cutter part begins (method file Methods_V_1.xsd):



Please note in the above code that we used the types defined earlier now to define request and response methods. 

The last item we need to create is a WSDL file  (Example_V_1.wsdl). Please notice how all the method specific settings are created from the base method name : submitDocument. If we wanted to add more methods we would copy the existing block in messages, port types, and bindings and rename with new base method name ( while keeping Request/Response parts).



Please note that when adding more methods we would add entry into each of the above segments (messages,port types and bindings). Each method would have base name and we would just add Request/Response as needed.


Now we have a clean WSDL contract that is platform independent. It is divided into 3 files. The methods file is very helpful for generating documentation and for discussion of required content (what fields are needed etc). There are many tools that will generate this documentation for you.



Thursday, June 4, 2015

Pesky TypeNotPresentExceptionProxy exception

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy



While creating an apache cxf client from wsdl I encountered the above exception. It was not easy to figure out what was the problem from the stack trace alone.
After some research I leaned that this exception is caused by annotation with a value that references class that is not in class path.
What that means is that a generated code ( in my case interface) contained something that was not in the class path.
To find out which annotation is causing the problem open your interface class ( if you are having this problem when generating code in apache cxf ) and check all the annotations that have specific reference to class in them. Example would be:
@XmlSeeAlso({org.someorg.ObjectFactory.class,org.someorgOther.SomeClass.class})

Please notice that the reference above is to SomeClass.class and to ObjectFactory.class (so those would be the classes I would check). If your error is at compile time then that class needs to be added to the path. If that is runtime error  (compiled  correctly) then you are most likely not including that in your deployment (but since it compiled, it is in your build path).

I hope this helps someone  if it does please leave me comment!