Happy Pi Day and Happy 10 Year Anniversary!

Company Blogs March 14, 2015 By David Truong Staff

Happy Pi Day everyone!

You guys should take a look at this site which makes some cool art from the number π.   Also reminds me also that I have two raspberry pi's that need some attention.  Anyone got any suggestions for them?

Today is also my ten year anniversary with Liferay!  Wow… I’ve spent a whole decade working for a company! This means I’ve put in 10000 hours and you can now consider me an expert on Liferay!  The company is vastly different from the one from ten years ago.  My mother didn’t even consider Liferay a company at the time and was hoping I find a job with a real company like IBM, Microsoft, or Oracle.  I think though that we've really grown as a company over the last decade.

Here's ten photos over the last ten years for you to see yourself:

Photo of the earliest employees of Liferay and me 20 lbs lighter!

An early release, Liferay Portal 3.6.1.

Before there were symposiums, we had a Liferay PUG (Portal User Group).

Original banner ads!

Getting our hair cut by students from a vocational school in Tumen.  One of our first forays into philantrophy.

Remember when I built my wedding website on Liferay?

First time in Madrid.

Liferay 2013 Retreat

North American Symposium 2014

This language is way harder than Java!  Hello world.  Welcome Kelsey.

If you've made it this far... I only have one last thing to share.  Becoming a father has taught me that you must show off your baby at every possible moment you can. One significant change that has happened within the last few years of Liferay was my move into a Product Manager.  It's sort of a fatherly role so I need to really do my best showing off my baby.  So over the next couple posts I will be showing off different parts of my Liferay "baby".  Her name is Platform.

Custom Finder for Portal Entities in a Plugin

Company Blogs June 22, 2012 By David Truong Staff

Sometimes you need to write a custom finder for a table that belongs to core. In my case it was JournalArticle.  My client wanted to avoid using the ext-plugin as much as possible so I had to try to figure out a way to do it within a portlet plugin.

I tried to use dynamic queries as a solution but it turned out to be inadequate because I was unable to group by (I wanted to get the latest articles with a certain structureId).

I needed a custom finder but for awhile I thought this was impossible because you needed to load the Impl of a model during the query which is inaccessible since it is part of portal-impl.  But my experimentation with dynamic queries was not in vain because I figured... if dynamic queries can figure out a way to load the impl class I could probably do the same.

So here is the class I wrote.

It consists of two basic methods:

public static Class getImplClass(Class clazz, ClassLoader classLoader) {
    if (!clazz.getName().endsWith("Impl")) {
        String implClassName = clazz.getPackage().getName() + ".impl." + 
            clazz.getSimpleName() + "Impl";

       	clazz = _classMap.get(implClassName);

       	if (clazz == null) {    
            try {
               			if (classLoader == null) {   
                    Thread currentThread = Thread.currentThread();

                    classLoader = currentThread.getContextClassLoader(); 

                clazz = classLoader.loadClass(implClassName); 
               _classMap.put(implClassName, clazz); 
            catch (Exception e) {
                _log.error("Unable find model " + implClassName, e);
    return clazz;
public static Session openPortalSession() throws ORMException {
    return sessionFactory.openSession();	

private static Log _log = LogFactoryUtil.getLog(CustomFinderHelperUtil.class);

private static Map> _classMap = new HashMap>();
private static SessionFactory sessionFactory =

So basically in my customFinder instead of doing

session = openSession();

I did

session = CustomFinderHelperUtil.openPortalSession();

and instead of doing

q.addEntity("JournalArticle",  JournalArticleImpl.class));

I did

q.addEntity("JournalArticle", CustomFinderHelperUtil.getImplClass(
                JournalArticle.class, true));

(I created a extra method that took a boolean to use the portalClassLoader, you can load it using PortalClassLoaderUtil.getPortalClassLoader())

Hopefully this helps some you guys out.


node.js with Liferay 6.1

Company Blogs March 7, 2012 By David Truong Staff

Wow, it's been a while since I last posted.  Liferay 6.1 EE has just been released and it's changed so much!  I decided to build a node.js app that calls Liferay using the improved JSON web services.  Really, I think this could work just as easily with 6.0 but whatever.  The project currently grabs the layouts of the Guest community and displays the portlets as widgets and using bootstrap for default styling.  

There's no reason for this project but I did it just to do it so it's more of a hacked together project but here it is for anyone interested in improving it or playing with it:


You will need a liferay 6.1 server running on 8080 using test@liferay.com/test.

Potential use cases:

  • Write a mobile site
  • Write a new frontend 
  • Integrate Liferay with another node app using this as an example

Things that might be fun to improve:

  • Grabbing the portlet data and writing our own front end
  • Adding user authentication
  • Add token authentication to Liferay so I don't have to hard code a user in my code.


That's it!  Hope my next post comes a lot quicker than this one.

Take care

Five years and already a liferay of memories

Company Blogs March 15, 2010 By David Truong Staff

This month marks the fifth year, I've been with this company.  A quick warning: I'll be sharing some personal thoughts so if you are looking for something more technical check out Ed Shin's post for that (we started at the same time, so it is his five year anniversay also).

Liferay was my first real job.  I was 22 when I accepted my Liferay position and they gave me 3 days to move to LA.  It was the scariest decision I had made in my life but it has turned out to be one of the most rewarding.

I remember the first day I arrived thousands of miles away from home (I'm from Chicago), I walked into 6 guys in a tiny cubicle.  On that day I connected with my ancestors a little bit more as I tasted what they must have went through working in Chinese sweat shops.  That though was not the biggest shock of the night. 

I was told that they would provide room and board when I went to LA.  They told me a hotel or some alternative would be provided.  The alternative was provided.  The alternative was Brian Kim's friend's apartment floor.  Yes, Brian Kim's FRIEND's apartment floor!  This floor was to be shared by Brian Kim, Ed Shin, and me...  If you are wondering how I made it past that first day... I've wondered that same question many many times. 

I can do all things through Him who gives me strength.

Things actually got worse.  A few days later, I discovered BKim's friend was a trader and went to sleep at 10 pm and work up at 5am.  The bathroom was conviently located in his bedroom.  It was 10:30pm.  I needed to use the bathroom but I was afraid to wake up his friend so I just held it.... until the morning.  I never fell asleep that night because I was afraid I would accidently pee in the queen size aerobed I was sharing with my coworker Ed who I had met yesterday. 

"Have I not commanded you?  Be strong and courageous.  Do not be terrified; do not be discouraged, for the Lord your God will be with you wherever you go."

Things actually got worse.  So I let Brian Chan and Brian Kim know that I was uncomfortable living at BKim's friend's apartment floor.  Ming-Gih one of the other new hires let me know I could stay with him.  He lived at his friend, Wilson (who eventually joined the company)'s sublet room floor.  It wasn't much of an upgrade but at least the room was private, the bathroom wasn't located in some strangers room, and because the friend was going out of town, I could sleep on the floor by myself.  We stayed there two days before the police came and informed us that Ming Gih's windshield got smashed over night.  Wilson's landlord thought we were part of a gang so we left in search of a new home where we could rest our feet.

"For I know the plans I have for you," declares the Lord, "plans to prosper you and not to harm you, plans to give you hope and a future."

The next day Mike Young graciously volunteered his home and took care of us the rest of the weekend.  That was my first week in LA.  Honestly at the time, I was ready to go home already, but I'm glad I didn't.  Looking back at it now, I laugh and realized it made the rest of the journey that much more memorable.  That was just the beginning and definitely things could only get better from here... right?

My New Obsession: SEO and Liferay

Company Blogs February 3, 2010 By David Truong Staff

So BChan should have never given me a server.  Since making my wedding site, I've been exploring different things about websites outside the scope of portlet development.

This includes:

  • Setting up a full web server (not just running startup.bat)
  • Business (if you could call what I'm doing business) Requirements
  • Advertising (adsense, etc.)
  • SEO

The last one has become somewhat of an obsession for me.  It seems silly to want to have Google/Yahoo/Bing list your website because after all who is going to want to search for my wedding website, but there is something truly satisfying knowing that you are ranked in the single digitals for a search query.  I am current ranked 3 for "david and winnie" because there's some dude named David Winnie... arg!

Well anyway's I've come to let you guys know my discoveries (that is if you care at all about SEO) so you don't make the same mistakes I did.

1.  If you can live with url sessions you should immediately disable it.

This is how: session.enable.url.with.session.id=false in portal-ext.properties

Most of us don't need it since most of us require cookies for our sites || (don't require cookies && url sessions) I would actually recommend everyone do this.  Here's an article that explains further why they suck and also shows you an alternative way to remove them if you aren't lucky enough to use liferay.

Why?  Because googlebot and all the other crawlers don't support cookies so the url's to your site all end up with ;jsessionid=12356yourseoisscrewed5950 and you end up with duplicate urls because ;jsessionid=12356yourseoisscrewed5950 != ;jsessionid=6079messedupseo459056.

2. If you need them, you need to set up mod_rewrites for them immediately

I can't give a full answer for this one since I've never done it.  But I did read alot of stuff so here are some suggestions...

Make a RewriteCond for Googlebot, MSNBot and all the other ones you can think of.

Then a RewriteRule that removes the jsessionid...

I'm not sure the what the answer is really... if you know leave a comment.

3.  If you've messed up and trying to recover from your mistake (same boat as me)

First read this article.  Then do what they say =).  It took me awhile to figure it out since I didn't know apache that well because I was trying to do everything in http.conf.  I had to do them in my virtual hosts conf file before it worked because I have my server running another site (maybe I can explain another day what I learned from that site).

You are basically writing a mod_rewrite that tells the crawlers that all urls with jsessionid's appended to them have moved and they will take them off the list of urls for your site.  This is good because you won't have duplicate urls which makes them think you have duplicate content.

So there you go...

If someone can tell me how to use robots.txt for virtual hosts.. or even setting it for just one server since all my sites will use the same robot.txt   And I did read the wiki... just need more explanations =)

My Wedding Website

Company Blogs January 21, 2010 By David Truong Staff

Hey guys,

So I promised I would put up a link and so here it is: www.winnieanddavid.com

Here were a few things I learned...

1) Weddings are really expensive... I should create a donate to my wedding portlet and let anyone send money to my paypal =P

2) Props to you if you are good at photoshop.  The pictures took me a long time to do and they don't even look great.

3) My site doesn't work in IE and I don't care

4) MP3 player's don't really work well for websites unless it's flash.

First a lot of people don't like them but my soon to be wife does so sucks to be them... 

Next reloading a page causes a song to start over each time... I spent seriously 2 weeks trying to figure out a good solution.  If you have a flash site, this isn't a problem but unfortunately I don't know how to code in flash/action script.  I didn't really want to use frames and in all honesty... I wasn't sure how to do frames in Liferay...  I tried a flash mp3 player with autoresume but it didn't seem to work in Firefox and I do care about that... so I decided on making the whole content part (everything under then nav and above the footer) refresh with ajax.

AJAXNav = {
	init: function(params) {	
		var layouts = jQuery(params.className);
	changeNavURLs: function(layouts) {
		var layout;
			function() {
				layout = jQuery(this);
				var friendlyURL = layout.attr("url").replace("/", "#");
				layout.attr("href", friendlyURL);
					function() {
						var a = jQuery(this);
						var p = a.parent();
						var plid = a.attr("plid");
						var friendlyURL = a.attr("url").replace("/", "");
						//var url = document.location.hash;
						 window.location.hash = friendlyURL;//url;
							"/c/portal/url?p_l_id=" + plid,
							function(html) {
								var layouts = jQuery(".sub-nav-item");
								if (layouts.length > 0) {
									console.log("processing .sub-nav-item");

That was the code I wrote in javascript.  If you noticed the url was /c/portal/url which basically hit a custom action I made that spit back portlet.jsp.  It worked actually fairly well actually but I had some other issues. 

The back button stopped working so I had to do some funny things with the url adding anchors (i.e. #home) to signal the page changed.

I couldn't get the AJAXNav to play nice with the twitter widget... and unfortunately that was just cut and paste from Twitter so I can't modify that code.  I actually wrote my own twitter portlet that parsed my rss feed so I could still switch to that but I'm not sure all that work I did was worth the effort anyways.

In the end I think I will just make the mp3 player into a popup so you can leave it running if you like or close it if it bugs you.

4) Now that you all discovered I am not a cartoon ninja, I have decided I must put up a real image of myself soon for my avatar (which I liked as a movie).


Love, Marriage, and Liferay?

Company Blogs December 23, 2009 By David Truong Staff

It's been awhile since I last posted a blog.  It's not like I had a bunch of avid readers; in fact I would be surprised if I even had one.  But nevertheless a lot has happened which has kept me away.  The most notable thing is that I got engaged and I am now in the process of getting married.

Being the prideful web programmer that I am, I decided I had to build my own website.  I was thinking which direction I could go.  I could have used Word Press.  It's easy and honestly it's a pretty darn good product.  In retrospect, it may have been the better choice but I decided to go with Liferay.  I used the EE version since I can generate my own keys but I could just have easily gone for the latest 5.2.x CE.  Both are excellent solutions.

I had to eat my own dog food I guess but right off the bat I want to tell you, it tastes pretty darn good.  I only brought up that maybe Word Press was a better solution because of a few things, cost and how simple my website was.  I'll let you guys know my experiences of using Liferay for my wedding site but if some of you guys want to stop now, here is the bottom line.  Liferay isn't the best choice for personal websites, but I can see why companies use Liferay and fall in love.  It is the best open source portal in the market (fact) and maybe the best portal period (maybe I am biased).

First thing first I go over the negatives of Liferay for my wedding website.

There were too many features, too many options.  In real life this wasn't a negative but because my website was so simple I had to decide between all the different options.  Should I go with cms, portlets, leverage existing Liferay portlets?  The options were endless.  It was a good and a bad thing.

Second and last negative.  This is a biggie.  I couldn't find a cheap place to host my site.  Java hosting is expensive!!!  Not quite as much as getting married but it's not like php.  I could have done tomcat hosting, but it was pretty complicated to get it working right and even harder to get it working with my plugins also since I didn't want to build anything in the ext.  I tried to get a vm but they were usually around 50 dollars a month!  When you're saving any way you can for the wedding of your dreams, there is no way to justify that. I was just going to have to swallow my pride and go to theknot.com and use one of their templates for my site.   Luckily Liferay, loves me and gave me my own private vm so I didn't have to resort to that =).

Ok now for the good things.

It's so easy to develope for Liferay.  The plugins have made my life as a liferay consultant so easy.  I built all my portlets and theme in a matter of a few days.  I'm a Liferay expert of course so it made things faster but still Liferay is simply a fantastic tool to use to build a professional website.  We could really change our product and call it Liferay Framework and I doubt anyone could disagree.

The CMS is so much better now.  I am one of the first employees in Liferay so I started using Liferay from its earliest versions.  I remember on one project for a non-profit we built much of their content on our CMS.  It was a nightmare.  We built some of their content with portlets because the CMS wasn't advanced enough to handle what we needed it to.  If we did the same project today, I doubt we would need portlets and I think I could have done the entire project myself instead of needing a 3 man team.  It has gotten that easy and that good.

There are a lot of features that are really made my life easier.  I used remote publish from my laptop to publish my website to my vm.  If I didn't want to do that I could have just manually exported my communtier to a lar and then import it back.  I could create different communities and host other sites if I wanted to.  And Liferay is almost easy enough that I might be able to ask my fiancee to do some stuff.

Using Liferay did allow me to do somethings Word Press wouldn't have allowed for (not that I know of at least).  I was able to build a guest list portlet where I could input all my guest and have them register what foods they want.  I can later export this to excel if I feel like doing that and I guess that's the beauty of using Liferay.  I feel like I have the power to do anything I want as long as I want to put some hours into it.

* Hopefully I can update this post with a link as I'm still in the process of getting all the content written =).

Idealist vs. Pragmatists

Company Blogs April 3, 2008 By David Truong Staff

I read an interesting article today.  You should probably read it first to understand my thoughts but I’ll summarize since most of you aren’t gonna read it and it’s a bit long anyways…  It’s talking about the decision Microsoft has to make with IE8.  The problem is that IE7 and below are all bad browsers because by default they are in quirks mode (it means it renders the page funny… ie style).  The dev team now has to decide if they want to go the same route or switch to standards mode which is what firefox, opera, safari does… and I know most of you are thinking oh of course switch to standards mode… but in reality the solution isn’t that simple because that mean’s millions of pages designed for IE (and IE8 is still IE) will now be broken.  The question is do you piss off the people who will be building the stuff for your product (developers) or do you piss off the people who’ve been supporting you (customers).

I thought this article was interesting not because I care what decision Microsoft will ultimately make…  but I think Liferay is finding themselves in this position with the release of 5.0.  We’ve already made decisions (java5) that will cause us to lose some past customers… (hopefully that will be offset by new customers that will pick us because of the decision).  I think we are at a crucial time where a lot of us are hoping to make even more drastic decisions that will further kill our backwards compatibility… but offer us in return the opportunity to make Liferay the best product it can be… like using Expandos or tighter integration with spring/hibernate or whatever…  we shouldn’t be tied down to our past anymore if we want to make a better future product.  But that’s never the path we take… (except java 5 which we were forced to do)… we always build for a way to be backwards compatible.  The key word here is TO BE.  We are not always backwards compatible by default (Neil found an issue with existing url's and the new JSR-286) which is why I of all people found this article interesting.

Everyone in Liferay is put into one of two sides:  There are the core developers and then support/consultants.  Yeah everyone does a little of both but primarily that is their job… anyways it’s hard as a consultant sometimes that the core team makes 80% of the decisions about the product when we do 80% of the (money-generating) work… I’m not being bitter like I think that’s the right way to go about it… just hard in that we have to figure out stuff like Neil’s URL issue without always knowing why it's happened (I've done every upgrade since 3.2 to the next version.. so I know how you're feeling Neil!).  So this has been complained about a lot before to the core team (that knowledge must be transferred better)… and it’s not really the point… but rather new insight because recently I went to China with Brian (Chan) and Nate. I spent some time working on core and spent time seeing people working on core.  And the improvements they are planning to make or are in the process of making is very exciting.  So exciting that I think older companies might be willing to pay more money to have these new features even if they have to abandon some previous work.

Anyways, if there’s only one thing you read about this post… it’s this: the article I read was really about Idealists (in our company it would be people like Nate who preach standards, standards standards… if they don’t want to support standards then screw them.. we want to make Liferay the product AWESOME) vs. pragmatists (in our company it would be Ed Chung… standards are good.. but they can’t get in the way of our ultimate goal… not to make Liferay product better… but to make more money for the company).   The article ended with this: “You see? No right answer. As usual, the idealists are 100% right in principle and, as usual, the pragmatists are right in practice.“  I realized that as a company, Liferay is constantly walking a fine line between the two, fighting to find that balance… and I think it’s also the reason Liferay hasn’t failed like so many other open source projects.


Blog Improvements!

Company Blogs October 29, 2007 By David Truong Staff

Our blogs has finally gotten a second look and I'm glad.  Blogs should be improved tredmendously and already I see people commenting on people's blogs.  Hopefully the response to blogs will be as positive as the ones we received for message boards and mail.  When Liferay decides to use our own products we really put in a lot of effort to make it a very good product so we should continue to see major improvements to blogs.  Already Brian Chan has told me we've just checked in a new commenting system that makes it way more usable and this weekend i finished writing tag libraries (which aren't restricted to blogs btw)  to add digg, delicious, furl, newsvine, technorati, blinklist, and reddit.  So soon you will be able to digg this article =).  I need to add a few more.. boingboing, fark, stumbleupon, magnolia...  but blogs is looking good... Next we should move all our docs into our own wiki so we are forced to rewrite it and make it awesome (Jorge already started)!


Company Blogs October 24, 2007 By David Truong Staff

"I took a look at jboss portal and concluded that nothing is wrong with liferay, haha" - bui

smart guy haha

Things Liferay should consider changing ASAP!!!!

Company Blogs October 23, 2007 By David Truong Staff

  • more scaffolding ant tasks that will fill in all those annoying xmls for us and create a basic portlet action
  • better urls... i know why we have the ones we have and why we need them but we need to figure out a way to simplify them even more... www.sitename.com as the home page without any apache url rewrites would be lovely (virtual hosts)
  • better blog!  guest cant even comment yet.. you need to dig in to the entry before you can comment
  • explore the possibilities of scripting languages more.... i think we support most of them now.. now lets try building something significant with them to see how good it is.
  • more unit tests even though they dont make sense alot of times so people will stop complaining
  • better documentation for simple stuff... how to override a jsp..  add a colorscheme.. differences between portal and portlet pages... small things that seem trivial to liferay experts but would help a newb alot.. and we actually have some of them but people cant find them so it means wherever we are putting them is too hard to find.
  • pull out all portlets to deployable wars... which will be tough since alot of portlets depend on each other.. which means those things need to be pulled out or those portlets need to be bundled together..
  • redo permissions ui more..  its supposedly alittle better now..  but still.. it kinda sucks
  • add narrow and wide views back to columns so we can define how portlets should look if its in a narrow or wide view.. it used to be in 3.6 but we thought we didnt need it.. but we were wrong it turned out to be useful.. a little at least
  • load javascript better smarter or smaller... one of those.. nates been working on it and its making progress
  • sessionless stuff is super buggy..  it looks promising.. we should improve it...
  • get someone to design a theme thats crazy looking cause we havent seen one yet...EDIT..the aqua theme was pretty crazy...a new one like that!
  • build a text to image filter and also a gradient filter...  to help the themes out.
  • and last but not least make my blog public because i must be heard!

Lotus vs. Excel

Company Blogs September 26, 2007 By David Truong Staff

A recent blog made a comparison between Lotus 123 and Microsoft Excel.  I found it interesting because our CSA Brian Chan often uses this example when describing Liferay's company strategy.  And while I already posted on how I felt our product has become somewhat bloated, the article reminds me all the more, that it definitely is better to have too many features rather than too few.

But another thing i found interesting was the point he made about javascript sizes.  If you've been following our discussion forums, you would have noticed that one of the most talked about topic is javascript sizes.  If what this guy writes is true, maybe our javascript size isn't an issue at all (which i admit is quite large at the moment).  If yesterday I felt we were building Liferay backwards, today I feel like Liferay is being built for the future .




Built Backwards?

Company Blogs September 24, 2007 By David Truong Staff

I've noticed in alot of our projects, we've been ripping alot of the "features" from Liferay and it got me thinking...  Maybe we built Liferay backwards and judging by the new features we've been implementing (plugin system most notably), I'm almost certain we did.  The portal might be the most featured packed portal out in the market but unfornately, most projects we've been doing has used only a handful of the features at any given time and rarely needs or even want the other features included.  While it's definitely great that we have so many features, we've made a grave error in not making  these components optional.  Instead of becoming a more flexible product we actually became the very opposite.  Our product has become bloated.  I'm glad the core dev team has seen the problem and moved quickly on correcting it.  I've been playing around with the new plugin system and it just seems to open a door to so many different possibilities.  Maybe one day we will finally see a Liferay Lite (Literay?!?) and everything is optional.  That would definitely make Liferay portal truly flexible and perfect for just about any site.  I guess for now having a portal with too many features is (WAY) better than having a portal without any features.

Showing 13 results.
Items 20
of 1