Vitamin C and Cough.


Cough...Cough…! Back in days, my family and friends used to remember me a coughy guy, used to catch serious cough infection at least four times a year. And when I used get it, it lasted for two weeks or more. It was a frustrating experience, as this episode was going since last couple of years or more. Each time I had to try more concentrated cough syrup to get rid of it. To overcome with my anxiety, I changed my physicians, hoping previous one was not good. But as stupid my attempt sounds, more worst were outcomes. It never worked out…in short.

Every Time I asked doctors, how to avoid this crap and then I always used to get mostly one type of response. You have to be more healthy, change your diet, do exercise, improve your immune. Ohh god… no doubt all tips make sense, but how can I make it effective. I am vegan, do regular exercise, have control diet. What else you expect, a solid athlete… or body builder.. or else.

Anyway, the same frustration came one day in dinner table discussion at someone’s place when I was in casual chat with the person next to me, hearing this episode he immediately got interested and for next 10 minutes he immensely narrated how much he was too frustrated with same issue. He even told he used have often visited each year by primary physicians. After a long time, I relaxed and felt someone is here with a similar mess… I so mean by the way, but surprisingly the next tip he gave has completely solved this headache.

His tip was simple and very effective, “Fill your body with Vitamin C”, that's it??? yes, that's it. His experience was great, he said consider your body has stock of vitamin C. If stock finish cough comes, and if you make sure you never allow stock to go down, you hardly ever get cough. Motivated by this next for a month I tried to drink daily two glass of orange juice, weekly two vitamin C supplementary packets. And voila… my cough is gone. I tried this trick for every 3 months, and now If I look back its more than 18 months and I don't see catching a cough at all.

Simple trick, easy to follow but it never clicked my mind. Now If I remember back in days, each time doctor also used to tell me the same tip, but most of the time this tip used to get dissolve with other dozen tips in my mind.

Whatever, I see there is one thing is there to learn in this episode, never lose attention when you get multiple things. Weigh each option one by one, and always start with easiest one. It could help and save your time.

New programming language: Be a fast learner.

“Do you have any tips to learn this programming language… in a shorter time???” If I am correct this question I might have asked many folks at the younger age of programming world, and surprisingly I now hear same question getting directed to me (I realized I am not the only one… who was crazy to ask this) by many freshers, novices in office, tech meetups or community groups.

The answer to this question...which I at least used to give is pretty straightforward… in fact its ISO 9000 certified answers… like get a good book, start with coding demo application, form learning groups, devote time regularly… although no one can deny these but in reality I was never confident of my certified answer.

Just last week, I have picked one iOS prototype project to code, and as a newbie to iOS ecosystem, I have been asked the same question again… but this time asked was me. Hence for the first time I was curious how can I come up with effective steps which can certainly fuel my language learning. Gearing for the mission, I spent couple of minutes to find out what other experts suggest for the same problem, I gathered many of them which made sense.

After a week of development, and assessing those tips, I filtered, corrected many of them. So here is the final list of tips which made sense to me. Hope it helps others as well..


  • Get the real concept of the language:

    This is the first and foremost important tip. Different languages are designed to solve different types of problems. Going back to basics, sets the mindset and expectation what could be the next journey.

  • Gather all relevant material at first:

    We don't start a long journey without getting stuffed right accessories, same applies for this case. Getting right tool, the right source of documents and a possible help of real live resource to fix quick mess up would be most important. Real help could be your colleague, friend if none possible easily through StackOverflow, healthy ad-free twitter groups like code newbies, flatiron school are best options.

  • Truly, Understand the Documentation:

    It's very important to thoroughly understand core prefix and indexes of documentation at the front. It helps to avoid very common type of frustration most of us get down the line when right information needed. This tip is highly undervalued among all but knowing it on time will really make a difference.

  • Find a Cheat Sheet:

    Every programming language comes with the set of quick cheat sheets for common commands, most used functions like logging, debugging. It's also important not to miss it at the front.

  • Relax and take a break:

    It makes sense that once you've done the gathering of materials, reading and understanding the basics, to dive right into piecing together a demo application. But, in order for proper learning to happen, you have to let the information marinate in your mind over the course of a few hours. Best take a break for a day and let the information seep in your head overnight.

  • Learn with Short Examples — Don't try with a big project:

    It’s important to focus on an individual aspect of the language at the beginning in isolation of others. Big project always carries many aspects of the language and other third party systems which can derail the learning in the initial days. Integration with other aspects is best learned once you have a solid foundation in the language.

  • Type in All the Code Examples Yourself:

    If you are damn serious about your business, what you are trying to achieve here then this tip is more practical. You have to be a maniac about typing while you learn. Typing stimulates memory and retention along with questioning mindset at each step, self-learned and much much better than glancing at them in a book or in a video. Down the language new language doesn't matter much, what matters is patterns, syntax and typing in the examples and making them work is perhaps the most important part of this learning process.

  • Make It Run! :

    I think one of the key best way of learning something and also manage growing interest by having smaller accomplishments, either it may be assignments, challenges or bug fixing. And all this won't happen in learning until close the door behind you before opening a new one. Always, always, always make your program run. Debug it until the result is correct.

  • Rely on Real People:

    Reinventing a wheel while learning or coding is highly undesirable. But the truth is it happens quite often knowingly or unknowingly. There might be a case where new beginner stuck in very silly issues which takes hours to fix or understand but can be solved within a minute by an experienced person. So its always better to have a backing of the real person when needed. There are different places where you can look for help, like office colleagues, stack overflow, language's forums, meetups or outside resources like twitter.

  • Make a Time Commitment for Learning:

    Context switching the major term you might hear while working in the software industry. If you move your mind from one work to other, you have to go through at least 15-20 minutes before settle down to newer task if they belong to different domains or context. Same applies while language learning. Learning in large, uninterrupted chunks is the best way to really soak in the language. Small learning sessions over the course of the week aren't that productive for learning a language than blocking out a day or two where your schedule is free for other tasks.

  • Break the boundaries … Go One Step Further to be a master:

    Finish each lesson, labor exercise and also try to take it one step further with related scenarios or problems. Doing this has a couple of advantages, you get familiar with language documentation that main, but you also get reinforce the concepts in the lesson.

Reversing the Natural Order: Mentoring Visibly Senior Resources.


I have seen it couple of times, so do many of us.. I think. Say either its due to work culture or its different phase of someone's life to move in career. But if you work in IT and work as a Lead role for resolving team issues, advice for process improvement, work on better communication between them or play the role of mentor with many of them are visibly older than you, you may hear these sayings… sometimes

“It feels very strange to get mentored by someone younger than me.”

“You know what, working with young people would be inconsistent and awkward”.

If you have that kind of workspace, and especially if you are in New York City, you also may hear different versions.

You can feel weird to be managing people who have been working longer than you – but it doesn’t need to. The challenge is not uncommon and it’s not insurmountable either. It takes just the right mix of thoughtfulness, tact, and strategy. After experiencing back in days, I thought to note down the couple of valuable insights, which may be helpful to others.

  • Be a good communicator.

    Being a good communicator means knowing when to listen and when to share. Many times we cut out the listener points and give them early ideas, but everyone on all sides feels their ideas and opinions were being dismissed. It really takes a good amount of effort to be quiet and listen. Nothing wrong to take time to process the response to make it digestible. One thing is sure If your colleagues feel valued, and heard, you become mature by their eyes.

  • Become a source of stillness.

    One of the common behavior with young minds is they get overwhelmed very easily and that's the worst thing mentors has to deal with. Certainly there are mentors of all ages who share this trait, but being youth and inexperience make the situation more worst than others. If you become a source of stillness for your team, you win the game and your age never matters.

  • Know your stuff.

    Knowledge doesn’t just come only from book or training but it mainly from years of experience. You have to work harder to gain more knowledge and experience to be a person of worth trust to your colleagues because they don’t think you have enough credits. Knowledge is also one of the keys to creating trust. People respect people they like, but they respect more people they trust.

  • Ask great questions.

    It's very likely in initial days you may get upset to say you don’t know something. But you know what, its always great to be open. When you ask questions, they will be less likely to think of you as a “ Smart pants”. Also, asking questions opens the bridge with both sides and comforts.

  • Understand differences in lifestyle.

    Every person goes through a different phase of their life, many of them do have different priorities in life like families, kids. Expecting similar level of commitment or enthusiasm like yours from them to learn new technology or process is not good. It's better cut them some slack. Try reorganizing social events to be inclusive for all.

  • Be clear on goals while in discussion.

    Micromanagement is the real killer of management structure. Being a mentor and not to be in a loop of micromanagement is a real challenge. If your colleague is doing some kind of work for years and you’re suggesting new process or better way of doing, they might feel awkward about trying to guide. Best way, in this case, is to get aligned around to big picture goals and stay focused on what matters is most important. Better give your colleagues a room to use their experience to get the work done.

  • Be ready to answer the age question.

    Technically it’s illegal for someone to ask your age in the workplace, but in reality people ask it anyway. So its better give some serious consideration to how you want to answer the inevitable question. If you don’t want to disclose your age, then say something like “old enough to do the job.” If you are comfortable with sharing, go ahead. I prefer it!

  • Know what motivates them.

    I really recommend working hard and figure out the motivation points for each individual. They may want flexible hours, or they just want own space. Make it realistic and try and see how you can match that with company's and employees expectations.

  • Improve a mentorship program.

    I have seen in most of the mentorship programs is active been participated by younger crowd only. For seniors, it may not be the right fit socially sometimes, but by strategically there can be a case for a senior employee can mentor younger ones or interns. Best thing I would like to do is to partner with organizations and school if the employees they are willing to make it more motivation and peer pressure only is their experience. It may be good for the company as well as society.

Java Melody: Happy Monitoring.

It’s no mystery, estimating a software development project is difficult. Many focus on time spent coding and testing the application but fail to account for the issues that normally arrive towards the end of a project’s lifecycle. Performance testing, maintenance, and other feature additions can easily turn into sleepless nights and an over-schedule/over-budget project, but they don’t have to.

Monitoring is an essential exercise for keeping your application healthy.

The ability to identify issue-prone areas in your application, early in the project’s timeline, can help minimize hiccups and headaches and improve your chances for a stress-free deliverable.

Beyond that, there are a few more reasons to consider continuous monitoring...

  • Identify problems before they become too serious
  • Optimize based on the more limiting response times
  • Find the root causes of response times
  • Verify the real improvement after optimization
  • Check out the different types of memory being used (Heap, PermGen, Cache etc.)
  • Give facts about the average response times and number of executions
  • Provide data to help improve applications in QA and production

Monitoring can be achieved using JMX-based solutions like Metrics or Server. For low-level JVM based monitoring, there are standard JDK tools like jconsole, jstat, jmap, jstack or hprof. For full-fledged monitoring solutions, which can be incorporated during the development phase of the project, use a tool like JavaMelody or Lambda Probe.

Monitoring with JavaMelody

JavaMelody is an open source (LGPL) application used to monitor Java or Java EE application servers. It measures and calculates statistical information based on application usage. The resulting data can be viewed in a variety of formats including evolution charts, which track various operations and server attributes over time. There are also robust reporting options that allow data to be exported in either HTML of PDF formats. Time is always scarce in development, so it’s useful to work with a tool like JavaMelody which has low overhead, is non-intrusive, and provides useful information.

Installation

Installation is fairly simple and can be done in just a few minutes. You can download the distribution from JavaMelody Wiki and extract the javamelody.jar. Alternatively, if you’re using Maven with a Spring-based framework, it’s best to follow the maven repository configuration instructions.

JavaMelody and Dependencies

Configuration

1. Web.xml configuration

JavaMelody requires a monitoring filter before the web app’s servlet in WEB-INF/web.xml.

You can exclude data from certain urls by using the url-exclude-pattern regular expression. Additionally, email-parameters can be used for configuring weekly reports and by including the monitoring-spring.xml file, you can monitor data sources with a Spring post-processor.

2. Spring Security configuration

If you are required to restrict access to monitoring statistics, the following configuration needs to be added in Spring Security’s applicationContext-security.xml. Ensure that the monitoring filter in web.xml (above) is defined after the Spring Security filter chain.

3. EhCache configuration

If you also want to see EHCache statistics, add statistics=”true” to the ehcache.xml config file.

4. SQL and Data source configuration

For monitoring data sources and SQL, add a JNDI-lookup to applicationContext-persist.xml

5. Business facades (Spring) Configuration

As described in the User guide for monitoring Spring Business facades, there are a few of options available for monitoring objects controlled by frameworks like Spring and EJB.

Option 1. JdkRegexpMethodPointcut

With JdkRegexpMethodPointcut in applicationContext-web.xml you can catch objects with a regular expression that matches all objects that have “Service” in their name.

Option 2. Use of an annotation of JavaMelody. This is the most convenient and adaptable option. Just add the annotation @net.bull.javamelody.MonitoredWithSpring to all implementation classes and/or interfaces and/or methods of interfaces which you want to monitor, without modification of your applicationContext.xml file.

Option 3. Use of MonitoredWithInterfacePointcut Assuming all business facades have a common interface (or superclass), for example “com.xyz.Facade”, add the following code snippet to applicationContext-web.xml to monitor all the related facade methods.

Statistics & Reports

All the statistics can be viewed in HTML, by navigating to the following URL:

    http://<Host>/<ContextRoot>/monitoring

The url can be customized in the configuration file. Reports can be viewed in weekly, daily or monthly formats. They can also be downloaded or can be sent by email in pdf format. iText library for WebApps and Java’s Mail and Activation library is required on the server in order to use the mail session. The report provides the same information you can find on monitoring web page with both high-level and detailed information. JavaMelody statistics from development:

1. CPU, Memory Usage


2. Detailed SQL Information


3. SQL Statistics


4. Server Requests


5. System threads, Caches


6. Data Caches


System Overhead

Features come with a cost, and JavaMelody is no exception. On the JavaMelody Wiki, you can find a healthy discussion about system overhead. It seems that the general consensus is that the overhead cost caused by JavaMelody is very low and that the feature is safe to enable full-time in a QA environment. If no problem arises, you might consider enabling JavaMelody in your production environment as well. Using a tool like JavaMelody can lead to valuable insights on how to optimize servers or uncover otherwise hidden issues, providing value that exceeds the overhead cost.

As an FYI, here are a few more details about how JavaMelody handles data:

  • JavaMelody records only statistics and not events so the overhead of memory is quite minimal.
  • No I/O on the wire and minimal I/O on disk

Summary

“Measurement is the first step that leads to control and eventually to improvement. If you can’t measure something, you can’t understand it. If you can’t understand it, you can’t control it. If you can’t control it, you can’t improve it.” - H. James Harrington

Improvement requires constant feedback. Leveraging a tool like JavaMelody can provide valuable data about your applications performance with minimal overhead.

Jacoco: Production Ready Code Coverage.

Jacoco code coverage library

JVM-based frameworks have several open source coverage technologies. Considering java’s penetration and usage currently in the software industry (particularly in open source environments) the list of coverage tools shouldn’t hold any surprises. But when it comes to the actual implementation of Java-based projects (with standard stack including Spring, Struts, Velocity, Tapestry, Maven, Grunt) these open source coverage technologies start to fall a little short of expectations.

Most of them are specifically fit to a particular use case such as Ant tools or IDE plugin (Mainly eclipse) and do not offer a good documentation nor clean API, both of which would allow developers to embed in different context or architecture designs. The biggest problem is that none of them are actively maintained these days, and, therefore, don’t support current java versions.

So after some research, I encountered Jacoco code coverage library. Jacoco seems to have taken a different path altogether to provide a new standard technology for code coverage analysis in JVM based environment. It provides a very lightweight, flexible and well-supported online community, works with all major development frameworks and standard build tools, and due to its open source nature it’s found a place in many tool vendors, IDE plugins, and open-source projects. Considering these factors, I decided to use Jacoco in Java, Spring based application with Maven build tool support.

Important Features

  • Coverage analysis of an application with Package, Classes, methods and line level with most important cyclomatic complexity.
  • Maven plugin to collect coverage information and create reports integrating with Maven builds.
  • Good performance with minimal runtime overhead especially for large-scale projects.
  • Lightweight implementation with minimal dependencies on external libraries and system resources.
  • Support report formats (HTML, XML, CSV).
  • Regression tests with full functional test coverage based on Junit test cases.
  • Framework agnostic: Smoothly integrates with Java VM based applications like plain Java programs.
  • Compatible with all released JDK.
  • Simple integration through Java agent based on-the-fly the instrumentation. Based on Java bytecode and, therefore, works also without source files.

Quick Setup.

Maven (pom.xml)

Report Generation.

Jacoco reports get generated in each full maven build lifecycle.

Eg. ‘mvn clean install.’

Report generation can be tied up with different maven lifecycle phases like pre/post unit or integration tests as well. From above configuration, were report generation has been tied to the package maven phase then following simple command would also work. Eg. mvn package Maven build can also be tied to test Coverage percentage. Build will fail in case coverage ratio drops beyond specified level.

Report Location.

Reports are generated at the following standard location.

<Project_Location>/webapp/target/site/jacoco/index.html

Report location can be moved to the different location using ‘outputDirectory’ property in maven configuration.

<configuration>
    <outputDirectory>${project.reporting.outputDirectory}/jacoco-reports</outputDirectory>
</configuration>

Sample Reports.

Reports are generated with Green and Red color indicators with the Green portion representing the code covered in tests while Red indicates the portion not covered. It can also be viewed with different scope level (Class, Method… etc). The following snapshot covers most of the scopes with detailed statistics.

Scope: Package Level


Scope: Class Level


Scope: Method Level


Scope: Line Level



References

Encounter with MadEye.

Fast pace is one of the key identity of agile teams. I strongly believe in keeping team sit and work together, no matter what stream they belong either QA, Tech, Designers or Business Analysts. Over the years, working together drastically increase the functioning of speed and timely deliverable.

But we live in real world, a part of complex system, no matter how aggressive you plan but making a team of qualified resources from all required stack is very hard, maybe impossible in digital agencies for shorter project durations, hence we have to work with remote teams.

It's a big pain, but certainly the right way of using technology I think we can pin down the issue up to a certain extent. And recently through the use of Google Hangouts we see significant improvements in daily scrums. But one common task of collaboration between developers always got sidelined and in-fact usage of all different tools of desktop share, hangouts also did not yield fruitful results.

What I expect if some engineer reaches me and ask for help in his code….

  1. Either I ask for send me the file : Crap option
  2. Share the desktop: Smaller fonts can't beat even bigger Mac screen
  3. Come to my desk: If close its fine, but a lil far context switching screws 15 mins ideally.

And recently I see MadEye, a one of the best solution I think currently in the market with free licensing. This product really impressed me at first glance. It's accurately precise for development where any developer can highlight, change the code in the browser and have a watch on terminal same time for errors or warning. This exactly what developers needed in collaboration.

I would be happy to see this tool being a part of must use engineering stack in all development projects. I also have enough points to put my case in front of tech directors.

Great work MadEye team, keep it up.


Blog getting a reboot.


I am blogging last couple of years, on different variety of topics ranging from technology, politics, philosophy, experiences. Today I have decided to start blogging on newer blog domain.

No doubt, I have learnt a lot from past writing, but after having recent casting on hand a single minor fracture on thumb joint showed me how can such small thing have bigger impact on day to day life.

It's always great for a person to focus on the skills, resources he has and should work for better utilization of those. With this learning, I am clearing most of my older blogs and starting fresh inning with focus on better ideas and experiences.

Can’t wait to post next blog .... Yay !!!!