Sunday, November 27, 2016

Resolving Collision issues while working with wsimport maven plugin


Such situation may arise when you are dealing with multiple version of same wsdl and want to separate two stubs into different package.

Example snippet.




http://www.mojohaus.org/jaxws-maven-plugin/wsimport-mojo.html#xjcArgs

Saturday, August 6, 2016

Getting the MIME Type based on filename

If you have worked with documents over internet (http), you must be aware of what MIME Type is.
(In case this has suddenly made you interested to read more about mime type, you can check this wiki link.)

But while doing coding in java, the traditional approach or at least how I had been working with so far is, to have a hash/map of mime types and then get it based on the file extension.

Now, here is what Java provides an interesting feature to remove your worries. :-)
There is this interesting feature since I guess, java 1.7,  in java.nio.Files -> probeContentType which gives you content type. here is small test to demo the same.



Tuesday, July 26, 2016

Formatting Strings in Java, a better way of logging!


As developers we should always choose the elegant way to do things.
One of them, is writing the log messages. Logging is important as it's the only way to see what your users/application has done or doing. Hence, it should be done elegantly. :-)

For example, if you need to write a log like this:

logger.info("records updated for user:"+ userId + "of org id:" + orgId) ;

Instead, you can use String.format(), and pass formatted string like this: 

logger.info(String.format( "records updated for user:%s of org id: %s",  userId, orgId) ) ;


Friday, July 22, 2016

What Agile Scrum is not? And, breaking some myths about scrum....

In the madness of selling Agile and adopting the buzz, many wrong interpretation and implementation is rampant. We need to understand and remind ourselves that,

Scrum is not:

  1. Marketing gimmick!!! Please stop fooling customers by setting wrong expectations.
  2. about doing no documentation at all.
  3. about saving cost ( in longer terms may be, but not ROI take some time )
  4. a magic wand, that will produce software in a day/week.
  5. asking customer that we would do everything for you and you sit back, relax and enjoy. Rather, scrum is about sharing journey with customer.
  6. Making developers commit to some stupid timeline, and leaving developers no choice!
  7. Is not very helpful, if don't align/improve your engineering practices to be able to ship quickly.


Will continue updating this, based on my experience. Any comments or personal experiences are welcome. :)

There is no ideal world, but, we as professionals, must be aware of what is right and what is wrong and stop saying Yes, when you want to say No.

Scrum Values

People often talk about Agile principles and Scrum but they leave the Scrum values aside, probably deliberately since they are pretty tough to achieve and practice.

But, when we are practicing Agile its only important that we keep reminding ourselves about these values and drive to achieve them.
Recently, I attended a session on Scrum. I think the most important takeaway for me was Scrum Values. It's not an official version not even the exact version that I got. But, as I remember correctly, here they go:

  • Self Organization
  • Trust
  • Respect 
  • Sense of urgency
  • Avoid Shortcuts
  • Share Journey with customer
  • Courage
Its not often that you sit in a session and talk about the values. But, recently, I was attending one of internal session and one of top leader was speaking. He said couple of interesting point about company's values, one that these are the guiding principles and secondly whenever you are in a situation where you are not sure whether I am wrong or right, please refer to these values. If your actions are aligned with them, you are good.

The same goes with practicing Agile!
For example, if you are showing some courage to say NO to something you are uncomfortable with or your gut feeling is not allowing to accept it, you are good. 

Sense of urgency, I also somewhat interpret this as ownership of a task/issue. It is very important that when you own the task you drive till it is "Done", to whatever is the definition is.

Similarly there can be various scenarios where these values can act as guiding force. 

Keep looking for the anti-pattern and allow these values and (of course principles) to do a course correction.


Tuesday, July 19, 2016

How to use Custom Perl Modules

Perl modules are easy to create and are used a library which you can reuse in another program or modules. However, for use it you need to do a bit of tweak in the environment, so that the interpreter can find the perl module.

@INC is the array, which works like CLASSPATH, in case you are familiar with Java. so, in the beginning of your code you need add the path where to find the perl modules you are using,


BEGIN {
        unshift(@INC, '/lib');


 # considering my perl module is located in /lib folder, relative to the current perl file

Now, @INC is an array which contains the paths of libraries, in case perl it is .pm files. And, unshift is used to append the path in the begining.

So, this code tweak make Perl interpreter aware of the path and you Perl code runs perfectly fine.  



Wednesday, June 29, 2016

Git Cheatsheet


To create a branch and switch to it at the same time, run the git checkout command with the -b switch:
git checkout -b <branch_name>
Same as:
git branch <branch_name>

git checkout <branch_name>

To check the current status of the branch.
git status
To add the changes - from the root directory - will make all red into green, if you are using git-shell

git add .
To commit your changes - use "-m" - to add message
git add -m "committing for the first time"
To do a git push into your branch

git push origin HEAD:branch_name 
To rename a branch
If you want to rename a branch while pointed to any branch, then use:
git branch -m <oldbranch> <newbranch>
If you want to rename the current branch, you can do:
git branch -m <newbranch>

To delete  a branch 

deletes the branch locally, use -D to force delete.

git branch -d <brnach_name>
 To delete it form remote:

 git push origin --delete <branchName>


Saturday, April 30, 2016

Larry Wall: 5 Programming Languages Everyone Should Know



You should see this video if you are starting your career in programming or you are interested in programming. :)


Prototype

Prototype is another creation pattern. Intent:  - Intent is to create objects by cloning existing instance  - Specify the kinds of obj...