Sunday, October 12, 2008

Garfield Said...

Money is not everything. There’s MasterCard & Visa
钞票不是万能的, 有时还需要信用卡

One should love animals. They are so tasty.
每个人都应该热爱动物, 因为它们很好吃

Save water. Shower with your girlfriend.
要节约用水, 尽量和女友一起洗澡
 
Love the neighbor. But don't get caught.
要用心去爱你的邻居, 不过不要让她的老公知道

Behind every successful man, there is a man. And behind every unsuccessful man, there are two.
每个成功男人的背后, 都有一个女人.  每个不成功男人的背后, 都有两个

Every man should marry. After all, happiness is not the only thing in life.
再快乐的单身汉迟早也会结婚, 幸福不是永久的嘛

The wise never marry, and when they marry they become otherwise.       
聪明人都是未婚的, 结婚的人很难再聪明起来

Success is a relative term. It brings so many relatives.
成功是一个相关名词, 他会给你带来很多不相关的亲戚 (联系)

Never put off the work till tomorrow what you can put off today.
不要等明天交不上差再找借口, 今天就要找好
 
Love is photogenic. It needs darkness to develop.
爱情就象照片, 需要大量的暗房时间来培养

Children in backseats cause accidents. Accidents in backseats cause children.
后排座位上的小孩会生出意外, 后排座位上的意外会生出小孩
 
Your future depends on your dreams. So go to sleep.
现在的梦想决定着你的将来, 所以还是再睡一会吧
 
There should be a better way to start a day than waking up every morning.
应该有更好的方式开始新一天, 而不是千篇一律的在每个上午都醒来

Hard work never killed anybody. But why take the risk?
努力工作不会导致死亡! 不过我不会用自己去证明

Work fascinates me. I can look at it for hours!
工作好有意思耶! 尤其是看着别人工作

God made relatives; Thank God we can choose our friends.
神决定了谁是你的亲戚, 幸运的是在选择朋友方面他给了你留了余地

When two's company, three's the result!
两个人的状态是不稳定的, 三个人才是!
 
A dress is like a barbed fence. It protects the premises without restricting the view.
服饰就象铁丝网, 它阻止你冒然行动但并不妨碍你尽情的观看

The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn
学的越多, 知道的越多, 知道的越多, 忘记的越多, 忘记的越多, 知道的越少, 为什么学来着

Monday, October 29, 2007

A trick

javascript: document.body.contentEditable = 'true'; document.designMode = 'on'; void 0

remember the code above.
Try to put them on firefox's address box, something weird is going to happen.


:0

Tuesday, October 23, 2007

Becareful of sakai-api

Sakai provides a functional api, which can be used to interact with other components of sakai, such as User-api.
One thing worth of noticing is that, when you try to use such an api, never bundle this jar file within your project (component); otherwise there will be a conflict between the api within your project and sakai's.

Thursday, October 18, 2007

You can use Spring Framework to inject the service or use the cover:

1. Using Spring to get the service for your class (e.g. YourAppClass) (recommended)
1.1). Add the UserDirectoryService bean to the bean for YourAppClass


<bean id="org.sakaiproject.yourapp.logic.YourAppClass"
class="org.sakaiproject.yourapp.logic.impl.YourAppClassImpl">
<property name="userDirectoryService"
ref="org.sakaiproject.user.api.UserDirectoryService" />
</bean>


1.2). Add a variable and setter to YourAppClass to use the service in like so:

private UserDirectoryService userDirectoryService;
public void setUserDirectoryService(UserDirectoryService userDirectoryService) {
this.userDirectoryService = userDirectoryService;
}


2. Using the cover to get the service
* Note: This is not the recommended method, you should be using Spring to inject the service
2.1). Setup a variable to hold the instance from the cover

private UserDirectoryService userDirectoryService;


2.2). Get access to the service using the cover

userDirectoryService = org.sakaiproject.user.cover.UserDirectoryService.getInstance();






ATTENTION:: If you're using the first method, you should be sure of that your project is following sakai's structure, especially the bean's id.
I am using the second one.

Using Sakai API

In my case, the most useful object is the "user", because I need to identify who is the manager, and who is common member having merely the "access" ability:
Click here to know more.

first, get a "UserDirectoryService" via Spring Injection;
Then, use (UserDirectoryService) uds.getCurrentUser;
And now, we get a current user. With org.sakaiproject.user.api, we can know more about the operations on it.

Click here to know more SAKAI TIPS.

Wednesday, October 17, 2007

the "fmt" exception has been solved

It is amazingly easy.
What I need to do is to modify my "include.jsp" as:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>


<%@ include file="/WEB-INF/jsp/sakai.jsp" %>>
<body onload="<%= request.getAttribute("sakai.html.body.onload")%>;foobar()">




now, it should be working, no fmt exception at all.

Wednesday, October 3, 2007

Here comes Java file structure

  • org.sakaiproject.app-name
    • dao
      all dao api classes
      • impl
        all dao implementation classes
    • hbm
      hibernate mapping files only
    • logic
      all business logic api classes
      • impl
        all business logic implementation classes
    • model
      all value object POJOs
    • service (cannot use public)
      all publically accessible api classes related to the app
    • tool
      all java classes related to the tool (backing beans)
      • jsf, producers, params
        presentation specific classes related to the tool

Note: You may have your own package base instead of org.sakaiproject