Monday, April 2, 2012

Hausla Buland

जैसे कंधे पे इक दोस्त का हाथ हो 
जैसे  लफ्ज़ो पे दिल की हर एक बात हो
जैसे आखोँ से चिंता की चिलमन हटे
जैसे मिट जाए हर ग़म कुछ इतना घटे
जैसे राहोँ में सपनो की कलियाँ खिले
जैसे दिल में उजालो के दरिया बहे
जैसे तन-मन कोई गीत गाने लगे
जैसे सोई हुई हिम्मत अंगडाई ले
जैसे जीना ख़ुशी की कहानी लगे
जैसे खुल जाए रस्ते अब तक थे बंद

हौसला हो बुलंद
हौसला हो बुलंद
हौसला हो बुलंद
हौसला जैसे आस्मां से हो बुलंद
हौसला हो बुलंद
हौसला हो बुलंद
हौसला हो बुलंद
हौसला जैसे आस्मां से हो बुलंद
हौसला हो बुलंद
हौसला हो बुलंद
हौसला हो बुलंद

हो बुलंद.....

कवि -- श्री जावेद अख्तर 



You like to grab your own copy here

Sunday, April 1, 2012

Spring Managed DI for Quartz Jobs With Dependencies

Problem Statement:

Quartz scheduler (v 2.1.3) triggers a job which has its own dependencies which needs to be managed using Spring (3.1.1.RELEASE+)

Solution:

The Job

public class HttpDealsDownloadJob implements Job {
// NO DEPENDENCIES HERE
  @Override
  public void execute(final JobExecutionContext context)
      throws JobExecutionException {
    final JobDataMap jdm = context.getJobDetail().getJobDataMap();
// EXTRACT YOUR DEPENDENCY FROM JOB DATA MAP
    final HttpFileDownloader delegate = (HttpFileDownloader) jdm
        .get("job.delegate");
    delegate.apply(context.getJobDetail().getJobDataMap().getWrappedMap());
  }

}

Spring Context

<bean id="mySchedulerFactoryBean"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="configLocation" value="file:quartz.properties" />
<property name="jobFactory" ref="springBeanJobFactory" />
<property name="triggers">
<list>
<ref bean="myCronTriggerFactoryBean" />
</list>
</property>
</bean>
<bean id="springBeanJobFactory"
class="org.springframework.scheduling.quartz.SpringBeanJobFactory" />
<bean id="myCronTriggerFactoryBean"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="cronExpression" value="${my.cron.expression}" />
<property name="jobDetail" ref="myJobDetailFactoryBean" />
</bean>
<bean id="myJobDetailFactoryBean"
class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobDataAsMap">
<map>
<entry key="source.url" value="${my.deals.url}" />
<entry key="job.delegate" value-ref="httpFileDownloader" />
</map>
</property>
<property name="jobClass"
value="org.zero.gb.acequia.scheduler.HttpDealsDownloadJob" />
<!-- INJECT APPLICATION CONTEXT -->
<property name="applicationContextJobDataKey" value="appicationContext" />
</bean>
<!-- THIS IS THE CLASS WHICH ACTUALLY DOES THE WORK -->
<bean id="httpFileDownloader" class="org.zero.acequia.integration.http.HttpFileDownloader">
             <!-- your dependencies here -->
     </bean>

Wannabe Architect 101

I feel fortunate to be a professional Software Engineer as no other career option would have given me the luxury to contribute in myriad different ways and power to change them for good. But, with power comes responsibility and to conduct one self in graceful manners in adverse situations. Today, I'm going to share some of my first hand experiences working in technical leadership role;
  • you do not have authority - get this straight into your head, as it sets the foundation for our discussion.
  • you have to sell/evangelize your ideas - as you are not a manager you cannot (should not) try to force your ideas/opinions. However, you can evangelize the choice framework/ technology/ language options by providing a working proof of concept (be ready to trash it, if it doesn't works though!). Make note to address people's concerns like difficulty to comprehend the "new" thing or may be to help them appreciate the concerns you have about the existing thing. Remember, any change forces people to come out of their comfort areas. The change you are trying to accommodate must not be intimidating for PEOPLE
  • assert without being blunt - although i have no right to preach this but people who have worked with me be known that I'm very working aggressively on ways to put things in improved context.   Although, I still favor shared objectivity as it helps me focus on task at hand.
  • invest in your relationship - "If someone is strongly disliked, it’s almost irrelevant whether or not she is competent; people won’t want to work with her anyway. By contrast, if someone is liked, his colleagues will seek out every little bit of competence he has to offer."
  • people have short impression and long term memory - use it in your favor - it is never too late to start afresh lead by example, people will copy "as it works" and chances are some of them will eventually appreciate the concepts. You want your team to write unit tests, show them how you have written for some of the components in the current project and then tell them how it helped being productive, rather than the other way around. If you go gaga about DIs and AOPs and FPs  or any other alphabet soup and tell the benefits chances are people won't practice it however if you just do it and others in the team start identifying the improved productivity the smarter ones will copy. Be ready to help them without being preachy or The Guru.. you have created your community of users!!

Top it all be stateless! like one of those web-services which you might design yourself. Do not carry the emotional backlog you created with working with people you cannot stand or plain incompetent. Start afresh, it helps to travel lite.