2011年8月16日星期二

allowframebreaks

\frame[allowframebreaks]{\frametitle{}} allow auto page breaks.

\framebreak can manually break pages.

2011年8月15日星期一

Seamless integration with Java - Scala


Seamless integration with Java

Existing Java code and programmer skills are fully re-usable. Scala programs run on the Java VM, are byte code compatible with Java so you can make full use of existing Java libraries or existing application code. You can call Scala from Java and you can call Java from Scala, the integration is seamless. Moreover, you will be at home with familiar development tools, Eclipse, NetBeans or Intellij for example, all of which support Scala. It does not take long to become an effective Scala programmer when you are half way there already!

--http://www.scala-lang.org/node/25

2011年8月10日星期三

Java Enum

public enum Direction{initial, up, down}

public static void main(String[] args) {
  for (Direction d: Direction.values())
    System.out.println(d.name());

  // EnumSet
  EnumSet eSet = EnumSet.allOf(Direction.class);
  for (Direction d: eSet)
    System.out.println(d.name());

  // EnumMap
  EnumMap eMap = new EnumMap(Direction.class);
  eMap.put(Direction.initial, "to be expanded");
  eMap.put(Direction.up, "go upwards");
  eMap.put(Direction.down, "go downwards");
  for (Direction d: Direction.values())
    System.out.println(d.name() + ": " + eMap.get(d));

  // assignment
  Direction d = Direction.initial;

  // in switch
  switch(d) {
  case initial:
    ...
  case up:
    ...
  case down:
    ...
  } 
}
1. Enum can be used instead of public static final constants sometimes...
2. Enum can not extend or be extended...

2011年8月9日星期二

LOAD and TRAVERSE ontology with owlapi

OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

// load an ontology from the web
IRI iri = IRI.create("http://www.co-ode.org/ontologies/pizza/pizza.owl");
OWLOntology pizzaOntology = manager.loadOntologyFromOntologyDocument(iri);

// create a reasoner, many reasoner realize the OWLReasonerFactory interface,
// e.g. pellet, FaCT++, Hermit
OWLReasonerFactory reasonerFactory = (OWLReasonerFactory) Class.forName("com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory").newInstance();
Reasoner reasoner = reasonerFactory.createNonBufferingReasoner(pizzaOntology);

// traverse in OWLOntology
// get OWL_THING
IRI classIRI = OWLRDFVocabulary.OWL_THING.getIRI();
OWLClass clazz = manager.getOWLDataFactory().getOWLClass(classIRI);
// get subclasses.
Set subSet = reasoner.getSubClasses(clazz, true).getFlattened();
// check satisfiability of clazz
reasoner.isSatisfiable(clazz);

simpleR

simpleR
author: John Verzani
---------
数据
---------
最有用的快速输入小数据集的R命令是c。假设本笔记每页有如下数目的勘误:
2 3 0 3 1 0 0 1
在R会话中我们如下输入:
> typos = c(2,3,0,3,1,0,0,1)
> typos
[1] 2 3 0 3 1 0 0 1
注意:
  • 我们为一个叫做typos的变量进行了赋值
  • 赋值运算符是=。早期用<-做赋值,R1.4.0后两种都可以。
  • typos的值不会自动打印。
  • types值的前面有一个有趣的[1]。这是表示该变量是一个vector。
R包含许多应用于像typos这样的数据的内置函数。mean函数便是其中之一,它可以用来计算数据的中数(mean)或均值(average)。
> mean(typos)
[1] 1.25
同样,我们可以调用median,或var来求解中位数(median),或者是采样方差(sample variance)。语法是相同的。

Data is a vector
数据在R中存储为vector。这仅意味着它保存了数据输入的顺序。
首先,假设这些是第1章的第一份草稿中包含的勘误数目。或许随着草稿的改变保存不同的勘误数是有用的:
> typos.draft1=c(2,3,0,3,1,0,0,1)
> typos.draft2=c(0,3,0,3,1,0,0,1)

2011年8月8日星期一

论文所回答的问题

(摘自http://www.sce.carleton.ca/faculty/chinneck/thesis/ThesisChinese.html
论文需要解释的问题:
  • 研究的问题是什么;
  • 该问题是不是一个好问题(是否被回答过?是否有用处?);
  • 是否能够使考官相信该问题被充分地回答了;
  • 是否对知识作出了足够的贡献;