Recent Bloggers

Scott Lee

Staff
3 Mensagens
21 de Agosto de 2014

Martin Yan

Staff
5 Mensagens
20 de Agosto de 2014

Olaf Kock

Staff
77 Mensagens
19 de Agosto de 2014

Miguel Ángel Pastor Olivar

Staff
15 Mensagens
19 de Agosto de 2014

James Falkner

Staff
94 Mensagens
18 de Agosto de 2014

Josiah "Duke" Harrist

Staff
1 Mensagens
13 de Agosto de 2014

James Min

Staff
30 Mensagens
12 de Agosto de 2014

Adam Victor Brandizzi

Staff
3 Mensagens
12 de Agosto de 2014

Yogesh Sharma

1 Mensagens
12 de Agosto de 2014

Peter Mesotten

6 Mensagens
10 de Agosto de 2014

A perspective 3D Liferay desktop picture.

Company Blogs 5 de Março de 2013 Por Neil Jin Staff

This one was designed by using minecraft screenshot! When I see this, I am always feel this grand brandy! Simple, strong, stable and enough space for imagination. 

Hope you will like it. The full picture size is 1920x1080.

If anyone wants some other size, please leave a comment, I would like to make it.

 

1920x1080

Making a remote javascript library loaded dynamically by AUI and be an AUI plugin

Company Blogs 27 de Fevereiro de 2013 Por Neil Jin Staff

    In the real world project, there are times when a team develops some feature like google map, twitter, facebook that need remote javascript library between several portlets but for the same portal. There are many similiar features that needs to resuse many codes. We want out code to be consistence and easily to be managed and more importantly we don't want to waste time on mutiple people working on the same feature that ultimate increase the cost of a project and once there's a bug or requirement modification(people love to do that), that the whole team need to change their own code, which is really frustrating for the whole team.

    TWO ways we think of to solve this (actually there are more solutions):

    1. Making a shared js and code standard that everybody can read it and copy it to each own code.  This method still can not guarantee a developer that use the right code without updating their js file to the up-to-date.

    2. Making a global portlet as a dependency of the portlets. This portlet will mainly be set layout.static.portlets.all=<portletID>  in portal.properties and add a <liferay-util:html-top> tag to view.jsp page that loads the remote javascript libiary , and that all pages in the portal loaded the remote javascript library.

BUT, when using code like <script src="https://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places" type="text/javascript"></script>, in some network environment like some companies or countries, facebook, google does not work very well, so the whole portal pages became extreamly slow to wait the until loading timeout. In my test sample, The longest time to wait a loading of facebook script on a page that does not use any feature was 11.98s and 1m 24s for loading google map script under a total refreshing page (shift + refresh).

    Why do we have to do this, load a unused script in a page in such a poor network environment? This really ruins the work of our core engineer. Core Engineers took really huge effort on decreasing some ms of loading time, but we just can simply increase seconds of loading time by adding 2 scripts. Fanstastic devil

    We don't have to do this. We can easily get rid of the features at the requirement analysis period.

    Once the features were made sure to use, we would choose a better way to handel this. At least, not let every page to load the script that is not useful.

    So We can still make a global portlet as a dependency, and load the script that we need. BUT, this script is not from the remote site directilly. This will be an aui plugin that handels the connection when we need. So that solves the problem.

For example to load twitter's script, the summary script is like this

 

AUI().add('aui-twitter', function(A) {
 
var Lang = A.Lang,
TWITTER = 'twitter',
TWITTER_ADDR = '',
/*this version only support share button yet*/
TWITTER_BUTTON = 
'<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>'
;
 
var Twitter = A.Component.create(
{
NAME: TWITTER,
 
ARRTS: {
},
 
prototype: {
 
initializer: function() {
var instance = this;
instance._loadScript();
},
 
_loadScript: function() {
A.Get.script(
'https://platform.twitter.com/widgets.js',
{
onSuccess: function() {
//alert("load twitter script success");
}
}
);
},
 
createTwitterButton: function(options) {
var instance = this;
var button = A.Node.create(TWITTER_BUTTON);
var dataLang = (options.dataLang != null ? options.dataLang : instance.LANG.ENGLISH);
var dataCount = (options.dataCount != null ? options.dataCount : instance.COUNT_ALIGN.HORIZONTAL);
var dataURL = (options.dataURL != null ? options.dataURL : '');
 
if(options.largeButton) {
button.setAttribute('data-size', 'large');
}
button.setAttribute('data-lang', dataLang);
button.setAttribute('data-count', dataCount);
button.setAttribute('data-url', dataURL);
 
A.one(options.contentBox).append(button);
 
return button;
 
},
//can add more features
 
COUNT_ALIGN: {
HORIZONTAL: 'horizontal',
VERTICAL: 'vertical'
},
 
LANG: {
ARABIC: 'ar',
CHINESE_SIMPLIFIED: 'zh-cn',
CHINESE_TRADITIONAL: 'zh-tw',
DUTCH: 'nl',
ENGLISH: 'en', //can add other languages
}
}
}
);
 
A.Twitter = Twitter;
 
}, '@VERSION@', {skinnable:false, requires:['aui-base', 'get']});
 
 
Once the script is loaded, if an aui object is not generated, the script won't be loaded.
In the jsp page can simply add code like:
 
<div id="<portlet:namespace />twitter-share"></div>
 
<aui:script use="aui-base, aui-twitter">
AUI().use(''aui-twitter', function(A) {
 
var tObj = new A.Twitter();
 
var btnOpt = {
contentBox: "#<portlet:namespace />twitter-share",
dataLang: tObj.LANG.ENGLISH,
dataCount: tObj.COUNT_ALIGN.VERTICAL,
largeButton: true
};
 
tObj.createTwitterButton(btnOpt);
});
 
</aui:script>

 

If AUI can have an official plugin to support those famous libraries like google and facebook and etc it would be nicer. :)

A vertial 3D Liferay desktop

Company Blogs 23 de Dezembro de 2011 Por Neil Jin Staff

Recently I tried to draw a 3D Liferay Logo with AI at home. Haven't been drawing since graduate. Maybe it just an okey job to draw this, but it can keep me thinking new ideas, create new things.

'Cause through a picture we can imagine a lot of stories. Like in this picture I can think of a boy encounters a girl in Liferay. And draw them out. And use that as my Valentine's Day's desktop. I mean it could be many ways to keep imagination.

Mostrando 3 resultados.