1. Likeable Emails!
Wednesday, January 20, 2016
Thursday, January 7, 2016
Object Oriented Java Script
Below is the best sample for declaring makeCounter class and creating two objects counter1 and counter2 of the same.
Here this class returns three closure functions increment, decrement and value which share a common environment consisting of one private variable privateCounter and private method changeBy.
var makeCounter = function() {
var privateCounter = 0;
function changeBy(val) {
privateCounter += val;
}
return {
increment: function() {
changeBy(1);
},
decrement: function() {
changeBy(-1);
},
value: function() {
return privateCounter;
}
}
};
var counter1 = makeCounter();
var counter2 = makeCounter();
alert(counter1.value()); /* Alerts 0 */
counter1.increment();
counter1.increment();
alert(counter1.value()); /* Alerts 2 */
counter1.decrement();
alert(counter1.value()); /* Alerts 1 */
alert(counter2.value()); /* Alerts 0 */
Closure
It is an inner function that has access to the variables/ of outer function.
Closures can be used to allow public functions to access private methods and variables.
* Took notes from http://developer.mozilla.org
Here this class returns three closure functions increment, decrement and value which share a common environment consisting of one private variable privateCounter and private method changeBy.
var makeCounter = function() {
var privateCounter = 0;
function changeBy(val) {
privateCounter += val;
}
return {
increment: function() {
changeBy(1);
},
decrement: function() {
changeBy(-1);
},
value: function() {
return privateCounter;
}
}
};
var counter1 = makeCounter();
var counter2 = makeCounter();
alert(counter1.value()); /* Alerts 0 */
counter1.increment();
counter1.increment();
alert(counter1.value()); /* Alerts 2 */
counter1.decrement();
alert(counter1.value()); /* Alerts 1 */
alert(counter2.value()); /* Alerts 0 */
Closure
It is an inner function that has access to the variables/ of outer function.
Closures can be used to allow public functions to access private methods and variables.
* Took notes from http://developer.mozilla.org
Thursday, August 27, 2015
How to avoid saying No when you dont need to say!
In our daily life's let us say whether it is in office or at home many times you need not express your opinion bluntly and strongly. You will be taken as harsh person even though you are very kind at heart.
This is an important skill in inter personal skills and unfortunately it is never taught in school or mentioned by our elders. Some people easily picks this skill but for people like me it takes life time to practice this.
Lets take a simple situation lunch time in your office, every one are having their lunch and discussing some topics and discussion steered towards a recently released movie. Most of the group likes it but you didn't liked some aspects of the movie which are important to you. You have shared your thought on the same. Here group may just take it and continue or some one can further dissect your idea or thought. This is fine, here is the thin line; you should not get offended by others opinion on your opinion. If you just let the comment go then the discussion stops there it self, but if you start taking it seriously and start using more strong words and emotions then people may understand you wrongly and take this response as negative memory. Where in people may avoid you or may have created wrong opinion on you which is not at all needed. This further may effect work relationship and work.
This is an important skill in inter personal skills and unfortunately it is never taught in school or mentioned by our elders. Some people easily picks this skill but for people like me it takes life time to practice this.
Lets take a simple situation lunch time in your office, every one are having their lunch and discussing some topics and discussion steered towards a recently released movie. Most of the group likes it but you didn't liked some aspects of the movie which are important to you. You have shared your thought on the same. Here group may just take it and continue or some one can further dissect your idea or thought. This is fine, here is the thin line; you should not get offended by others opinion on your opinion. If you just let the comment go then the discussion stops there it self, but if you start taking it seriously and start using more strong words and emotions then people may understand you wrongly and take this response as negative memory. Where in people may avoid you or may have created wrong opinion on you which is not at all needed. This further may effect work relationship and work.
Thursday, July 2, 2015
3 things to look after for a Successful Agile Project
Every company wants to execute their software projects using Agile methodology, in fact many companies are thinking they are following Agile methodology. Agile methodology is not a one stop method to be adopted for all kinds of projects. It is a way to act promptly for changes in requirements when you are already working on requirements, these changes are derived based on rigorous user preferences study and interaction to improve the overall user experience.
I am going to discuss three important things you may want to look after for a successful agile project.
I am going to discuss three important things you may want to look after for a successful agile project.
Don't keep unpredictable facts!
This unpredictability nature of requirement changes or any other changes should have some acceptable limits to make the project successful. This needs commitment from every stake holder, that is from project sponsor, product ownership team and engineering team.
If a product owner has some thoughts on how the functionality he or she wants to see then don't wait for the feed back you are expecting from your entire user group, you can delegate the well described and documented prototype idea to your engineering team to get started and mean while try to arrive at the concrete functionality.
This approach truly follows the Agile in principle; engineering team is well engaged on the business problem, they themselves can offer some functional inputs and optimizations. And they get time to work on technical aspects and improvisations such as solution performance, browser compatibility, enabling multilingual, scalability etc.
Allocate sufficient time and money for training and learning resources
Make sure every member in your team has good understanding of the business domain you are into and business problems you are addressing.
Utilize the team wiki to communicate commonly used procedures, keep it simple and effective to maintain and add content quickly. Keep links to latest training/ recordings for new comers and for reference.
Provide access to test/development environment at the earliest to allow individuals try the learning's and become confident and ready.
Simple and effective tracking
Requirements should be documented with sufficient details to help Engineering team to refer and infer. Whenever a change happens it should be documented and communicated to all the stake holders.
Leverage the Requirement and bug tracking tools and their capability to send notifications up on changes. This ensures people involved are kept informed about the current state.
Wednesday, June 24, 2015
XML Streaming tip while using JAXB
Always streaming to xml files is recommended over full DOM writes.
If you are writing a big xml file and all child elements will not be written in one stretch or method call then writing individual fragments is efficient and practical.
Sample xml may look like:
<MyRoot>
<Child id="1" type="a"/>
<Child id="2" type="a"/>
<Child id="3" type="a"/>
.
.
.
<Child id="1001" type="b"/>
<Child id="1002" type="b"/>
<Child id="1003" type="b"/>
.
.
.
</MyRoot>
Lets us say <Child> elements of type "a" are to be added by method1() and type "b" are to be added by method2() then following snippet of code allows each method to independently write to same xml file in fragments. i.e without root element.
public void method1() {
try {
Employee emp1 = new Employee();
emp1.setId(100);
emp1.setFirstName("John");
emp1.setLastName("Macy");
emp1.setAge(29);
Employee emp2 = new Employee();
emp2.setId(88);
emp2.setFirstName("Linda");
emp2.setLastName("Stuard");
emp2.setAge(25);
File file = new File("C:\\myFile.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Employee.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
//This property allows writing xml child nodes without root element
jaxbMarshaller.marshal(emp1, file);
jaxbMarshaller.marshal(emp2, file);
} catch (JAXBException e) {
e.printStackTrace();
}
}
myFile.xml contents after execution of this piece of code looks as follows (without root element):
<Employee>
<Id>100</Id>
<FirstName>John</FirstName>
<LastName>Macy</LastName>
<Age>29</Age>
</Employee>
<Employee>
<Id>88</Id>
<FirstName>Linda</FirstName>
<LastName>Stuard</LastName>
<Age>25</Age>
</Employee>
If you are writing a big xml file and all child elements will not be written in one stretch or method call then writing individual fragments is efficient and practical.
Sample xml may look like:
<MyRoot>
<Child id="1" type="a"/>
<Child id="2" type="a"/>
<Child id="3" type="a"/>
.
.
.
<Child id="1001" type="b"/>
<Child id="1002" type="b"/>
<Child id="1003" type="b"/>
.
.
.
</MyRoot>
Lets us say <Child> elements of type "a" are to be added by method1() and type "b" are to be added by method2() then following snippet of code allows each method to independently write to same xml file in fragments. i.e without root element.
public void method1() {
try {
Employee emp1 = new Employee();
emp1.setId(100);
emp1.setFirstName("John");
emp1.setLastName("Macy");
emp1.setAge(29);
Employee emp2 = new Employee();
emp2.setId(88);
emp2.setFirstName("Linda");
emp2.setLastName("Stuard");
emp2.setAge(25);
File file = new File("C:\\myFile.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Employee.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
//This property allows writing xml child nodes without root element
jaxbMarshaller.marshal(emp1, file);
jaxbMarshaller.marshal(emp2, file);
} catch (JAXBException e) {
e.printStackTrace();
}
}
myFile.xml contents after execution of this piece of code looks as follows (without root element):
<Employee>
<Id>100</Id>
<FirstName>John</FirstName>
<LastName>Macy</LastName>
<Age>29</Age>
</Employee>
<Employee>
<Id>88</Id>
<FirstName>Linda</FirstName>
<LastName>Stuard</LastName>
<Age>25</Age>
</Employee>
Monday, June 22, 2015
Performing SVN Merges using Eclipse plugin
In most projects automated merges are configured, this make's sure that your feature branch changes are forwarded to required future branch or trunk. But some times this may not happen, when any merge conflict arises i.e. automated merge cannot be performed or any previous revision merges on the same file are pending so your merge is waiting in queue. Or if automated forward merges are not configured, in such cases you have to manually merge the code base by resolving the conflict's if any and merge your changes into future branch or trunk and commit the changes.
In eclipse IDE Right click on the project or folder on which you want to perform merge, from context menu select Team->Merge as shown in below screen shot.
This brings up below shown merge wizard, from which you can choose type of merge you want to perform. Below I will be explaining various types of merges available.
Each of the merge type is explained below:
In eclipse IDE Right click on the project or folder on which you want to perform merge, from context menu select Team->Merge as shown in below screen shot.
This brings up below shown merge wizard, from which you can choose type of merge you want to perform. Below I will be explaining various types of merges available.
Each of the merge type is explained below:
- Merge a range of revisions Use this method for performing forward merges to a branch from another branch or trunk. Typically changes from older branch are merged to newer branch.
- Manually record merge information (block one or more revisions) This option is helpful if you want to block a revision from making into svn branch or trunk. This can typically arise if you had to stop possible successful auto forward merges to keep the latest code being over written by older code.
a. Uncheck checkbox 'Perform pre-merge best practices checks', this is to ensure no revision from older branch being missed in the subsequent wizard display. Now click on 'Next' button.
b. In the next screen as shown below, enter (or select using 'Select' button) branch name and corresponding path from which you want to merge changes to target branch/trunk. Select option 'Select revisions on the next page' and click on Next button.
c. It will open up window showing eligible revisions for merge (same is shown below). Select the required revisions and click Next button.
d. It will show up conflict handling options screen, same is show below. This screen lets you take decisions for conflicts such as to prompt for each conflict or Mark conflicts and let me resolve later or Resolve conflict using your version or resolve conflict using incoming version. Once necessary option is chosen click on Finish button.
e. Once conflicts if any are present and are resolved, go a head and commit the changes. This will ensure that you have integrated your feature branch changes into trunk or other future branch and you wont receive any more auto merge failure e-mails.
- This can be achieved by choosing the 5th option in the merge wizard as shown in below screen shot. Subsequent steps are almost same as in above explained flow, you will be asked to choose the merge from branch & path and then select the revision you want to block and choose finish. This will make necessary changes in the file svn configuration and now you can commit the file. This will block the specific revision from auto merging into the SVN branch and also will not block subsequent pending merges from happening.
Please feel free to ask questions if you have any using comments section and also feel free to ask to cover any specific area that is missed.
Saturday, June 13, 2015
Subscribe to:
Posts (Atom)






