Saturday, May 28, 2016

耶鲁大学的格言 Light and truth 光明与真理 אורים ותמים

אורים ותמים 

耶鲁大学的格言 

 耶鲁大学的格言是希伯来文 אורים ותמים

 אורים ותמים (Hebrew) (读音Urim V'Thummim)
Lux et veritas (Latin)
Light and truth(English)
光明与真理(中文) 

下面是网站(https://en.wikipedia.org/wiki/Yale_University)上的官方解释。
The arms of Yale University, often referred to as the shield of the university. The device on the seal, a book bearing the Hebrew phrase אורים ותמים (English: Urim V'Tamim), originates from the early eighteenth century, and its designer is unknown.
 大意是:耶鲁大学的膀臂常称为大学的盾牌。
印上是一本写有希伯来文אורים ותמים (英文Urim V’Tamim,中文乌陵和土明)的书, 说是来自18世纪早期。设计者未知。

 我认为这个理解太肤浅。容我来解释一下。

 אורים ותמים那个希伯来文的翻译没有多少问题。

 תמים: Whole, entire, intact, blameless, sincerely, honestly, perfect in knowledge 整全,完整,无愧,真诚,诚实,知识的完备
אורים:Light 光明
所以译成中文为“光明与真理”是恰当的。但תמים本身的意思比译文丰富得多。 

我认为这个词不是来自18世纪,而是直接来自圣经。

首先这个词(אורים ותמים)多次完整出现在圣经中,意思是“从神那儿得旨意的装备或程序”。

 下面是这个词在圣经中出现的一些地方:

 Ex 28:30 (出埃及记28:30) 30ונתת אל חשן המשפט את האורים ואת התמים והיו על לב אהרן בבאו לפני יהוה ונשא אהרן את משפט בני ישראל על לבו לפני יהוה—תמיד  {ס} 30
你要把乌陵和土明放在作决断用的胸牌里。亚伦进入耶和华面前的时候,它们要带在胸前;这样,亚伦就在耶和华面前常常把以色列众子的决断带在胸前。 

乌陵和土明是从神那儿得旨意的装备或程序。这个装备放在祭司胸牌的口袋里。祭司到神面前去一定要带上这个装备。

 Lv 8:8 (利未记8:8) 8וישם עליו את החשן ויתן אל החשן את האורים ואת התמים 8
又给他佩上胸牌,把乌陵和土明放在胸牌里面 同上

 Dt 33:8 (申命记33:8) 8וללוי אמר תמיך ואוריך לאיש חסידך אשר נסיתו במסה תריבהו על מי מריבה׃ 8

论到利未,他说:“耶和华啊,愿你的土明和乌陵属于倚靠你的利未人,就是你在玛撒试验过的,在米利巴水边与他们争论过的。 

这儿“愿你的土明和乌陵属于倚靠你的利未人”,意思是愿神的旨意属于倚靠神的利未人(祭司)。

 Ear 2:63 63ויאמר התרשתא להם אשר לא יאכלו מקדש הקדשים עד עמד כהן לאורים ולתמים׃ 63省长告诉他们不可吃至圣之物,直等到有能用乌陵和土明来决疑的祭司兴起来。

 Ne 7:65 65ויאמר התרשתא להם אשר לא יאכלו מקדש הקדשים עד עמד הכהן לאורים ותומים׃ 65省长告诉他们不可吃至圣之物,直等到有能用乌陵和土明来决疑的祭司兴起来。 

这儿“直等到有能用乌陵和土明来决疑的祭司兴起来”意思是直到真正明白神旨意的祭司出现。

 圣经中的光有很多意思,下面是几个例子: 

光是圣经中记载神的第一个创造。光将黑暗分明。

光是在黑暗中为我们引路的。

圣经也用光描述神的话语本身。神的话语是我们脚前的灯,路上的光。

约翰福音描述神就是光。耶稣是世界的真光。 。。。。

 所以אורים ותמים一词来自圣经。 

耶鲁大学当初成立的目的是培养牧师。牧师相当于圣经中古时的祭司的角色。所以图中的书应该指圣经。旧约圣经主要是用希伯来文写成。也就是说耶鲁大学的当初的目的是紧紧围绕圣经,培养能明白圣经真理,时常来到神面前求智慧,在神人之间代祷的牧者。

Wednesday, October 28, 2009

Do not give your email id and password to any web site unless you know for sure what you are doing

I and my friends have received invitation from seemly friendly email from friend email to join them such as the "Desk Top Dating".

When you receive the email, delete it immediately and do not follow through it. This is a trap!

Generally, for any email/web site asking for login/password for another email account, don't follow through that and delete that email unless you know you are giving information to a well trusted email service such as google. Otherwise, you are in danger of exposing your complete email contact list to an unknown user/web site.

For example the mentioned "Desktop Dating" email, this is what the hacker site was doing:

1. in the email it ask you to input your email id (for example yahoo) and password,
2. the "desktop dating" site could use your yahoo email id and password and login to your email account and (don't be fooled by the encryption of the password that shows on the page)
3. read your emails and
4. fetch all your email contact and send the chain email to all your contacts.
5. The cycle continues back to step 1 for all your contacts and their contacts again and again unless you stop it from step 1.

If you already input your email id /password to site like that, change your password now, inform your friends do not open that email from you etc.

Sunday, October 25, 2009

Use GSON to access json response in grails action

Communicate with external service through gson
1. download gson package and extract the jar into lib directory
http://code.google.com/p/google-gson/
2. grails action

def fetch={
def data
def reader
try {
URL url = new URL("http://localhost:8080/controller/action");
reader = new BufferedReader(new InputStreamReader(url.openStream()));
JsonParser jp = new JsonParser()
JsonElement je = jp.parse(reader)
data = je.getAt("data");
reader.close()

} catch (MalformedURLException e) {
// ...
} catch (IOException e) {
// ...
} finally {
reader.close()
}
render data;
}

Saturday, October 24, 2009

Create google wave robot from grails

1. use grails 1.1.1 (1.2.M3 does not work yet!!!)
2. create a grail project gswordwave
grails create-app gswordwave
3. uninstall hiberante
grails uninstall-plugin hibernate

4. install app engine plugin, selected jdo ( default)
grails install-plugin app-engine
5. run the app with this command:
grails app-engine
6. kill it
7. do initial deployment and make sure it works without wave stuff
  • Register your application on appengine site. gswordwave
  • grails set-version 1
  • grails app-engine package
  • %APP-ENGINE-HOME%/bin/appcfg.cmd update ./target/war


8. download the google wave client jars from
  • http://code.google.com/p/wave-robot-java-client/downloads/list and copy all the wave client jar to the lib directory in the grails root dir, also download servlet.api.2.5.jar into lib
  • Bulleted List mkdir src/java/parroty/server
  • copy http://code.google.com/apis/wave/extensions/robots/java-tutorial.html src/parroty/ParrotyServlet.java into the above directory src/java/parroty/server and name it ParrotyServlet.java and update the package to parroty.server.
  • Make a web-app/_wave dir. Create in it a capabilties.xml file and copy paste the code

<?xml version="1.0" encoding="utf-8"?>

<w:robot w="http://wave.google.com/extensions/robots/1.0">
<w:capabilities>
<w:capability name="WAVELET_PARTICIPANTS_CHANGED" content="true">
</w:capability>
<w:version>1</w:version>
</w:capabilities>
</w:robot></pre>

9. In your appengine-web.xml (mine is in
c:\users\yiguang\.grails\1.1.1\projects\gswordbible\stage)file
you will find your application id is there already(mine, "gswordwave").


<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>gswordwave</application>
<version>0.1</version>
<sessions-enabled>true</sessions-enabled>
<ssl-enabled>true</ssl-enabled>
<system-properties>

</system-properties>

</appengine-web-app>


10. add your ParrotyServlet config into src\templates\war\web.xml :

<servlet>
<servlet-name>Parroty</servlet-name>
<servlet-class>parroty.server.ParrotyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Parroty</servlet-name>
<url-pattern>/_wave/robot/jsonrpc</url-pattern>
</servlet-mapping>


11. do redeployment

  • grails app-engine package
  • %APP-ENGINE-HOME%/bin/appcfg.cmd update ./target/war
12. check it out

http://gswordwave.appspot.com/_wave/capabilities.xml
13. goto your wave account and add gswordwave@appsport.com onto
your contact list and start to communicate with it

Wednesday, October 21, 2009

Pintout Unicode of a String

I don't use this often but I run into the problem occasionally. For example an special character in a text from database broken XML when it is put into xml. The problem is I don't know what character is doing it. So I need to find the unicode and replace it.

This is how to do it:
def thatString="sdsdsd sd fsd fsd fsd fsd fsd s ->s sd fsdf sdf "
that.toCharArray().each{ch->
printf("%04X%n", (int)ch);
}


This will printout all the unicode of the string

Monday, September 14, 2009

GWT on Google Appengine

The first part list the steps to create the first google app engine GWT applicaiton(Mostly copied from Google Instruction). The second part is more detail explanation.

1. Download Eclipse and install google app engine plugin

Eclipse 3.5 (Galileo)

http://dl.google.com/eclipse/plugin/3.5

2. Create applicaiton (areyouup)

File > New > Web Application Project (areyouup, com.asianwondersnet.areyouup)

(select workbench if not show up)

3. Running your Web Application locally

Right-click on your web application project and select Debug As > Web Application from the popup menu.

This action creates an Eclipse Web Application launch configuration for you and launches it. The web application launch configuration will start a server and the GWT hosted browser.

At this point, you can set breakpoints, inspect variables and modify code as you would normally expect from a Java Eclipse debugging session.

4. Deploying your Web Application

To deploy your web application, you will need to create an application from the App Engine Administration Console, at the following URL: https://appengine.google.com/. If you already have one, then you can skip this step.

Once you have an application ID, just right-click on your project, and select Google > App Engine Settings... from the context menu. Enter your application ID into the Application ID text box. Click OK.

Right-click on your project and select Google > Deploy to App Engine. In the resulting Deploy Project to Google App Engine dialog, enter your Google Account email and password.

Note: Don't worry - the plugin doesn't store your password anywhere.

Click Deploy.

Go to http://application-id.appspot.com/ to see your application.

The following is a little bit more detail. Here are the steps to add a new service. Using TestService as example.

1. Define TestService.java

package com.asianwondersnet.areyouup.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("test")
public interface TestService extends RemoteService{
String testServer(String name);
}

Please notice the relative path annotation above. We will use that information in web.xml

2. Define the TestServiceAsyn.java

package com.asianwondersnet.areyouup.client;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface TestServiceAsync {
void testServer(String input, AsyncCallback callback);
}

Notice the above two service interface both has testServer. But there is a little bit difference. The second one has a AsyncCallback argument which we will show it in entrypoint code.

3. Define the TestServiceImpl.java which implement the TestService interface.

package com.asianwondersnet.areyouup.server;

import com.asianwondersnet.areyouup.client.TestService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

@SuppressWarnings("serial")
public class TestServiceImpl extends RemoteServiceServlet implements TestService{

public String testServer(String input) {
StringBuffer sb=new StringBuffer();
try {
URL url = new URL(input);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line+"\\n");
}
reader.close();

}finally{
if (sb.length()==0){
sb.append("Please input the full URL for fetching data!");
}
}
return sb.toString();

}
}

4. Add the servlet configuration in web.xml

The name: testServlet

The class: com.asianwondersnet.areyouup.server.TestServiceImpl

Add the servlet mapping to web.xml

map /areyouup/test to testServlet

The relative path test is annotated in the TestService.java interface.

Also define the hosting page as welcome-file-list: Areyouup.html

The hosting page was generated automatically but you can change it from the web.xml file.

5. Now the entrypoing code: Areyouup.java (This was generated automatically when the application is setup on Eclipse).

package com.asianwondersnet.areyouup.client;

import com.google.gwt.core.client.EntryPoint;

public class Areyouup implements EntryPoint{

private final TestServiceAsync testService = GWT.create(TestService.class);

//The entrypoint
public void onModuleLoad() {

//Define the buttons/textfields specify style as necessary
final Button sendButton = new Button("Send");
final TextBox nameField = new TextBox();
nameField.setText("Input URL");

// We can add style names to widgets
sendButton.addStyleName("sendButton");

// Add the nameField and sendButton to the RootPanel
// Use RootPanel.get() to get the entire body element
RootPanel.get("nameFieldContainer").add(nameField);
RootPanel.get("sendButtonContainer").add(sendButton);

// Focus the cursor on the name field when the app loads
nameField.setFocus(true);
nameField.selectAll();

// Create the popup dialog box
final DialogBox dialogBox = new DialogBox();
dialogBox.setText("Remote Procedure Call");
dialogBox.setAnimationEnabled(true);
final Button closeButton = new Button("Close");
// We can set the id of a widget by accessing its Element
closeButton.getElement().setId("closeButton");
final Label textToServerLabel = new Label();
final HTML serverResponseLabel = new HTML();
VerticalPanel dialogVPanel = new VerticalPanel();
dialogVPanel.addStyleName("dialogVPanel");
dialogVPanel.add(new HTML("Sending name to the server:"));
dialogVPanel.add(textToServerLabel);
dialogVPanel.add(new HTML("Server replies:"));
dialogVPanel.add(serverResponseLabel);
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
dialogVPanel.add(closeButton);
dialogBox.setWidget(dialogVPanel);

// Add a handler to close the DialogBox
closeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
dialogBox.hide();
sendButton.setEnabled(true);
sendButton.setFocus(true);
}
});

// Create a handler for the sendButton and nameField
class MyHandler implements ClickHandler, KeyUpHandler {
/**
* Fired when the user clicks on the sendButton.
*/
public void onClick(ClickEvent event) {
sendNameToServer();
}

/**
* Fired when the user types in the nameField.
*/
public void onKeyUp(KeyUpEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
sendNameToServer();
}
}

/**
* Send the name from the nameField to the server and wait for a response.
*/
private void sendNameToServer() {
sendButton.setEnabled(false);
String textToServer = nameField.getText();
textToServerLabel.setText(textToServer);
serverResponseLabel.setText("");
testService.testServer(textToServer,
new AsyncCallback() {
public void onFailure(Throwable caught) {
// Show the RPC error message to the user
dialogBox
.setText("Remote Procedure Call - Failure");
serverResponseLabel
.addStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(SERVER_ERROR);
dialogBox.center();
closeButton.setFocus(true);
}

public void onSuccess(String result) {
dialogBox.setText("Remote Procedure Call");
serverResponseLabel
.removeStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(result);
dialogBox.center();
closeButton.setFocus(true);
}
});
}
}

// Add a handler to send the name to the server
MyHandler handler = new MyHandler();
sendButton.addClickHandler(handler);
nameField.addKeyUpHandler(handler);
}

}

The GWT has been simplified a bit from older versions. No more Service casting and the annotation also helps simplify coding.

6. Look at the Hosting page:

In the html header, link style "Areyouup.css" and java script src="areyouup/areyouup.nocache.js"
In the body define the field "nameFieldContainer" and "sendButtonContainer" refered in the code

Ok. Here is the play ground. It has the above function plus some more experimental image animation stuff. The URL:http://areyouup.appspot.com/


Thursday, September 10, 2009

Application development process for Google Appengine on Grails

Application development process for Google Appengine on Grails

This is the note I took while watching grocher 's Screen cast from the Grails 1.1.1 announcement
So all honor goes to grocher and the grails/groovy team.

1. grails create-app grails-music-store
2. Goto appengine.google.com, add new application grails-music-store . Note the app name must match
3. cd grails-music-store
4. grails uninstall-plugin hibernate
5. grails install-plugin app-engine
6. export APPENGINE_HOME=/Developer/appengine-java-sdk-1.2.0
7. grails app-engine
then goto 8080 and see the skeleton app
8. grails create-domain-class Album
JDO by default
9. grails generate-all com.music.Album
10. grails app-engine
On Windows, After kill the application, the java process is still running. I have to kill the java process manually. (currports is a nice tool for this process)
11. grails app-engine package
12. /Developer/appengine-java-sdk-1.2.0/bin/appcfg.sh update ./target/war
provide password //first time
It will fail. Fail because of version.
13. grails set-version 1 (This is not the app engine version)
14. do step 11-12 to build and deploy again
/Developer/appengine-java-sdk-1.2.0/bin/appcfg.sh update ./target/war
15. Check it out
http://grails-music-store.appspot.com/album/create (or list...)

Of course you need to install the app engine sdk first.