Monthly Archives: November 2011

Lorem Lipsum

Lorem Lipsum

Source: http://www.lipsum.com/

“Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.”

Do you find the above passage familiar? If yes, can you guess what language it’s written by?

“Lorem lipsum” is simply a dummy passage which often appears on mocking website. Since the first appearance at 1500s, it soon become the standard text for printing and typesetting industry. Surprisingly, such an old standard still survive till today.

There are 3 reasons to use “Lorem lipsum”. First, it looks more like natural English than “Content here Content here …” text. Reading it give the customers a more accurate image of how the text look like when the site is complete. Second, the content on mocking website shouldn’t be uP/nderstandable, because many studies have point out that people are inclined to be distracted by readable text. And finally, since it has become a standard, it’s a shared background for any content layouters.

And… in case you don’t know, the content of “Lorem lipsum” actually has a meaning. It’s a Latin text taken from ”de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC – a popular book during the Renaissance.

I have been developeing website for more than a year, and such simple things always make people surprised…

P/s Thanks bro Lai Huu Nhon – a senior from my company (Evolus) – for this piece of knowledge. And by the way, I think his layout is cool.

Text

Force refreshing second level cache in Hibernate

/** Vietnamese: cách xóa second level cache bằng code trong Hibernate**/

Hibernate second level cache is helpful, but only if using wisely.

In the ordinary context, if you delete an object in database by Hibernate, Hibernate will know and update its cache. But if the object/ tube got deleted by other programs (or by cascade delete set up in database itself), Hibernate won’t know and won’t update anything. Hence the deleted objects may remain in the cache for quite a time, and your code may throw an exception or two when trying to get items related to that object.

It’s a good practice to do every database-related thing through Hibernate. But in reality, sometimes we must do the other way around:

@SuppressWarnings("unchecked")
private void evict2ndLevelCache() {

  try {
    log.info("Evicting all Entity Regions of 2nd Level Cache");
    sessionFactory.getCache().evictEntityRegions();
    Map classesMetadata = sessionFactory.getAllClassMetadata();
    for (String entityName : classesMetadata.keySet()) {
      log.info("Entity from 2nd level cache:" + entityName);
    }
  } catch (Exception e) {
  log.error("Error evicting 2nd level hibernate cache entities: ", e);
  }

}

The solution provided here is an alternate of the solution in this question. Thanks brother Tinh for this information.

Running JMeter from command line

I trust that someday, you will understand me.

Though out there are plenty documents to run JMeter with Ant task, sometimes it’s not the best solution. For example, if the plan is to run several test scripts on several cloud server instances, it may not worth the effort to install Ant on each of those instances.

In that case, we can run JMeter script from command line, using one statement in the followings:

[jmeterBinDirectoryPath]/jmeter -n -t <testfile> 

or

[jmeterBinDirectoryPath]/java -jar ApacheJMeter.jar -n -t <testfile>

Credit goes to this blog post and this discussion in mailing list.

Google isn’t a history book anymore

Google

It’s not as cool and hot as the barrel roll trick, but the other news from Google today really catch my eyes.

The story is here.

In short, Google made changes to its algorithm to alter search result behaviors. In stead of results with more than several months old, now you get newer results (maybe only minutes after it was online).

It mean that Google changed the way they do searching. They do change. They are not satisfied with what they achieved, but they seek to improve on. And this improvement is one of the things that Google could do better.

(From my own experience, in past it took several weeks to a new blog post from WordPress make it way to Google search results.)

Cheers for it!