1. Why Mybatis?

Short answer: simple, lightweight, open source, dynamic sql and sql control, previous iBATIS knowledge. Now let me elaborate a little bit on the subject. Back in the old days of Podcastmania.ro, see Story of Podcastpedia.org, I used my own MVC like framwork based on servlets to develop the web application and plain old JDBC to access the database. After “upgrading” to Spring MVC, I started using Spring’s JdbcTemplate for database access, which removed some of the boilerplate code. Later I got involved in projects where database access occured via iBATIS – Hibernate was there for a long time, but because of legacy reasons and no database normalization whatsoever, iBATIS was the optimal choice. By about the same time MyBatis had been just launched, so I read the documentation, did a pilot, liked it and switched from Spring’s JdbcTemplate to MyBatis. In the mean time I’ve been working on projects with Hibernate and JPA 2.0 with Hibernate used for persistence, so I’d say I have a pretty good overview on the most popular Java Persistence Frameworks. You have currently four major options:

  • JPA/Hibernate
  • myBatis (former iBatis)
  • Spring JDBC
  • JDBC

Octocat Source code for this post is available on Github - podcastpedia.org is an open source project.

Continue Reading ...
Sample Post with Feature Image
Image source: dargadgetz

This post demonstrate how to use feature images on your posts.

Just add:

  feature: filename.png

where filename.png is an image inside images folder. This image will be displayed on the top of your post.

Warning! The image height is not limited. The image width will be adjusted to fit on the post container, make sure to not use images with a high height.

Post content after <!-- more --> tag.

This is a sample post to show the dark post theme. To use this dark theme, just add:

layout: dark-post

on your post. This theme adds a dark background with a white panel to show your content.

Here be a sample post with a custom background image. To utilize this “feature” just add the following YAML to a post’s front matter.

  background: filename.png

This little bit of YAML makes the assumption that your background image asset is in the /images folder. If you place it somewhere else or are hotlinking from the web, just include the full http(s):// URL. Either way you should have a background image that is tiled.

If you want to set a background image for the entire site just add background: filename.png to your _config.yml and BOOM — background images on every page!

Background images from Subtle Patterns (Subtle Patterns) / CC BY-SA 3.0

1. Why use Caching?

Are you aware of the Pareto principle, also known as the 80-20 rule, which states that, for many events, roughly 80% of the effects come from 20% of the causes? Well, this principle also holds true for Podcastpedia.org, where most of the traffic is driven by some of the podcasts, and only some of the search criteria are used the most. So why not cache them?

For application caching Podcastpedia uses Ehcache, which is an open source, standards-based cache for boosting performance, offloading your database, and simplifying scalability. It’s the most widely-used Java-based cache because it’s robust, proven, and full-featured.

This post presents how Ehcache is integrated with Spring, which is the main technology used to develop Podcastpedia.org

Octocat Source code for this post is available on Github - podcastpedia.org is an open source project.

Continue Reading ...