Tag Archives: running

#102030: Celebrating 20 Years of Java by Running 20 10K in 30 Days

May 23rd, 1995 was a momentous day in the history of technology. It does not seem the industry realized that a language released on that day would completely change the landscape of technology in the coming years. Java will be celebrating 20th birthday on the same date this year.

20 years of Java, wow!

Java 20th Anniversary

Go back 20 years in the memory lane and think about when/how Java was invented. World Wide Web was for elites, 5 1/2″ floppy disks, dial-up modems, bulletin boards, e-commerce was just launched. There were, of course, no smart phones, Netflix, Twitter, Facebook, Uber, or any such technology. Pause for a few seconds, think about all the years in between in terms of how the language and the platform has evolved.

Embracing, rich, powerful, reliable, capable and robust are some of the words that come to mind. All of these technologies are now powered by Java!

Isn’t this LEGEN … wait for it … wait for it … wait for it  … DARY (in Barney Stinson’s style 😉 This is truly legendary!

C was invented ~43 years ago, C++ ~32 years ago, Objective C ~32 years ago, and C# ~15 years ago. And which is the only language, other than C, that has stayed among the top 2 languages in Tiobe Index?

Java, of course!

And it is now the top language, once again, for April 2015.

Tiobe April 2015

I joined Sun Microsystems back in Mar 1999 when JDK 1.2.2 was planned. It was extremely fortunate to be part of the inaugural release of J2EE 1.2 (yeah, that’s what it used to be called back then, not any more though) in Dec 1999. And since then the world has been a very different place in enterprise Java world. So Java community is definitely close to heart!

Learn and watch some really historical artifacts from one of the nighthacking sessions:

Here are some master pieces that I’ve possessed over the years:

Java 20 Badges Java 20 Banners

Java 20 Duke  Java 20 Ring

Enough background! 20th birthday of Java demands a celebration. So what do we do?

How to celebrate?

A trek to Mt Everest Base Camp was planned to celebrate the 20th anniversary of Java. Flight tickets were booked, trekking company was engaged, clothes and gears were purchased, and lots of other interesting conversations were happening. The goal was to reach Mt Everest Base Camp on May 23rd and celebrate the anniversary at one of the highest point in the world. However due to unforeseen and unfortunate circumstances, this trek is now cancelled. Fortunately, there was a guardian angel protecting us!

So how am I going to celebrate 20th anniversary of Java?

As an avid runner, I’d like to run twenty 10ks in 30 days of May. Each 10k will be dedicated to one year of Java. Now the distance can certainly be greater than 10k, but it has to be at least 10k.

My runs can be tracked at movescount.com/members/arungupta or on Strava:

Hopefully it will inspire some other Java community members to pick up a healthy activity during the month of May.

You don’t necessarily have to run. There are other ways to celebrate #102030:

  • 20 days of 10 pushups/pullups/squats for 30 days
  • 10 sets of 20 pushups for next 30 days, or 30 sets of 20 pushups for 10 days
  • Donate $10 to 20 charities of your choice, or $20 to 10 charities, or $20 * 10 to 1 charity of your choice over 30 days (e.g. Devoxx4Kids)
  • Write 20 tips on how Java can be used in 10 topics over 30 days
  • Write 10 blogs with 20 tips over 30 days
  • Take 20 minute power naps every day (suggested by @evanchooly ðŸ˜‰

Pick any combination of 10, 20, 30 and use #102030 to share how you are celebrating the 20th birthday month of Java :)

Whats your #102030?

Paris Marathon 2015 – Electric and Runtastic

It took me ten years to run first international marathon. But so glad I choose Paris Marathon as the inaugural run. The experience was electric, really amazing, and runtastic.

Paris Marathon 2015

There are several common trends observed after running San Francisco, Sacramento, Napa Valley, and Big Sur marathons over the past years. So I’m taking this opportunity to share what I liked about the race, and what could possibly be improved. Some of this feedback may be tinted as I’ve only run marathons in the USA only so far.

Paris Marathon – The Good

  1. Cheerleaders: Number of spectators through out, literally through out, the course was definitely the best part of the race. And there were ~250,000 of them. Men, women, families, and so many little kids stretching their hands out and waiting for high-five, really kept the runners motivated.
  2. Attractions: How many races go through tourist spots like Eiffel Tower, Louvre, and Seine? OK, to be fair, San Francisco has Golden Gate Bridge and Golden Gate Park, Napa Valley has vineyards lined through out, and Big Sur runs along Highway 1 next to Pacific. In addition, how many races can claim to start and finish at a beautiful venue like Arc de Triomphe?
  3. Mile markers: Mile markers were done really right. They were tall, big bold numbers, and nicely stretched on a frame instead of fluttering flags. They could possibly withstand wind and rain, although the weather was very cooperative. Another important aspect was that there were mile markers, in addition to KM markers. This made it really helpful for the US runners as we are more used to former.
  4. Music: ~100 local bands were playing through out the race. There were very few moments that the music could not be heard.
  5. Corrals: With 50,000 runners (35% outside France and from 183 countries), the corrals were very well organized on Champs de Elysees. The corrals were starting with 3 hour pace, 15 minutes apart, and closed ~15 mins before their start.
  6. Paris Fire Department was sparing water using their hose at several points through out the course. Anybody running a marathon can appreciate the importance of that when the temperature is ~55-60F.
  7. Expo: This was the biggest expo with ~200 booths. It even had a 80m (CHECK) running track to try out new running shoes. There were plenty of clothes, running gear, accessories, etc. All the runner’s name were printed on a wall, and that was quite a crowded destination for everybody.

Paris Marathon – Areas of Improvement

  1. 436,497 number of plastic bottles with almost a million liters water were handed throughout the course. Based upon my personal observation, ~30% of the water was wasted. California is going through fourth year of drought, and there are several countries with severe water shortage. Hey, these places can take all the water! And plastic, really? Use paper glasses, runners and mother nature would love you for ever.
  2. Sports drinks (Powerade) were offered only once during the entire course. Plain water does not supplement the electrolytes lost during the race and so they should be offered at each water stand, in addition to water. That’s what I’ve experienced in all the US races so far.
  3. Water stations were at ~5k. This is fine for the first 15 miles, but they need to more frequent in the later miles.
  4. Pre-cut bananas were offered at each water stand. But banana peels and cobble stone do not make a good combination. Pre-peeled would be preferred.
  5. Finishers shirt was given after the finish line. It should instead be given at the Expo as that is more convenient.
  6. Only a limited number of food stalls were at the Expo. And also no place to hydrate.
  7. Communication on the pacing strategy with the pacer was futile as they didn’t know how to speak English.

This race made me create a new bucket list item, and that is to run a marathon in all seven continents. North America and Europe are now checked, lets see which one will be the next one.

I also like the idea of Conference Driven Marathon as suggested in the following tweet:

Lets see which conference is going to align their schedule with a marathon. Conference organizers, game on 😉

You are definitely missing out if you’ve never run this race. Its a big race, go run it!

Log your miles and community runs: Java EE 7 Real World Experience

miles2run-logo

miles2run.org is an easy way to track your running activities and share with friends and families. Day-based or distance-based goals can be created and then tracked. It also allows to create community run goals and have multiple runners participate and track their activities towards that goal. You can also find out local runners and connect with them.

The project was started to help track running activities for #JavaOneStreak. The goal was to run at least a mile every day all the way until JavaOne and use this website to track the runs. There are tons of sophisticated applications and websites that allow you to track running activity. Most of them provide integration with your GPS watch, phone GPS, and other fancy features. Some of them even allow creating a group but none of them is based on Java :-)

The application is hosted as a website and built using HTML5 and Java EE 7. The landing page provides a summary of total runners, their city/country, miles, and hours logged so far.

miles2run-landingpage

The website can be viewed on a desktop, tablet, or a cell phone. The runners can login to the website using common social brokers such as Facebook, Google, and Twitter.

Any body can click on “Community Runs” on the top-right corner to see what all group runs have been created so far. These can only be created by an administrator. The group run page for JavaOne shows how many runners have joined this run and other statistics.

miles2run-javaone-mainpage

Each runner is presented with a dashboard showing how much distance they’ve run so far and total/completed/remaining/missed days.

miles2run-javaone-dashboard1

A visual representation of the progress and a heat map of the activity calendar is shown:

miles2run-javaone-dashboard2

A line chart of mileage over the days is shown:

miles2run-javaone-dashboard3

And then a summary of activities over the past months is shown as well:

miles2run-javaone-dashboard4

Runners also have the opportunity to follow other runners and track their activities.

Here is a conceptual view of the application:

miles2run-architecture

And here is a technology view of the application:

miles2run-tech

Here is a brief description of the technology stack:

  • Presentation
    • Thymeleaf template engine views rendered by JAX-RS
    • Social brokering using native APIs for Facebook, Google, Twitter
  • Middle Tier
    • @Stateless EJB for all transactional JPA interactions, @Asynchronous for posting status to social networks
    • JAX-RS for exposing REST endpoints. ContainerRequestFilter and ContainerResponseFilter for security for cross-cutting concerns like authentication, injecting profile, and CORS.
    • Bean Validation constraints in JAX-RS resources.
    • Bean discovery mode=”all”
  • Backend
    • CDI producers for creating EntityManagers and other configuration objects like Redis connection pool objects or MongoDB configuration object. All NoSQL services are created @ApplicationScoped.
    • Using native drivers for Redis and MongoDB. Jedis is being used for Redis and MongoDB Java driver is used for MongoDB. CDI services wrap these driver API and expose business functionalities that other layers could use.
    • JPA + Bean Validation. Database scripts are generated from JPA model, added to source control, manually applied to the database. Using @Index and Entity Graph.
    • Servlets are used for callback URLs for social brokers.
    • Error pages are configured using <error-page>.
    • MySQL is used for all business entities like Activity, Goal, User Profile etc. Redis is used for storing counters and timeline data. MongoDB is used for location-based user recommendations and follower/following recommendations.

Technologies from outside the platform:

  • JavaScript
    • D3.js and C3.js for visually appealing graphs
    • AngularJS for views
    • Cal Heatmap for calendar heatmap
    • jQuery
  • Google Geocoding API to convert Location Text to latitude and longitude
  • Jadira usertype for storing dates in UTC
  • Joda-Time for working with dates
  • Thymeleaf was used instead of JavaServer Faces because:
    • Allows JAX-RS to be used as an MVC framework to render server side HTML pages and exposing REST services.
    • This application is a Single Page application built using AngularJS. So, we needed a lightweight approach to render server side pages. JAX-RS along with Thyemleaf render the main HTML 5 page and then we use AngularJS to render different partials/views on that page. For example, the main home page is rendered by JAX-RS and Thymeleaf. When you work with different sections of this page all of them are part of a SPA managed by AngualarJS.
    • Thymeleaf documents are valid HTML 5 documents so you can work with them offline for static prototyping.
  • Redis is used for storing all the counters like number of runners, cities, counters specific to goal like total distance covered in a goal etc. To avoid lots of read/write from the database, an an in-memory database is used so all the write and read operations are very performant. Redis counters are atomic, which means there are no concurrency issues associated with it. INCR andINCRBY Redis operations are used to update counters.
  • MongoDB is used for location data.

Toolset

  • JDK 8
  • IntelliJ 13.1 with Maven
  • Wildfly 8.1.0.Final – Development was done using a local WildFly instance and then pushed to scalable WildFly instances on OpenShift for deployment. HA Proxy is used as the load balancer.The advantage of working with OpenShift is that there is no OpenShift specific code in your application. So, it’s the same application that work locally that is deployed to test and production environment. You just have to use environment variables to abstract out environment specific configuration.
  • Github

Planned updates

  • Use Jenkins for Continuous Integration and manage deployments
  • JPA 2.1 converter instead of Jadira
  • Keycloak instead of native social broker
  • Opensource the application

Wish list for Java EE 8

  • Integration with OAuth providers
  • A real MVC framework with support for pluggable template engines
  • Seamless working with NoSQL databases

Download WildFly 8.1 today, learn the technology by reading/trying Java EE 7 samples, browse through Java EE 7 resources.

Or if you want to be on the bleeding edge, check out WildFly 9.0.

Many thanks to Shekhar Gulati (@shekhargulati) for authoring the application and providing all the answers!

Are you using Java EE 7 and WildFly to deploy your projects ? Would love to feature you here! Send me an email or leave a comment on the blog.