Skip to content

Instantly share code, notes, and snippets.

View Nan-Zhang's full-sized avatar

Nan-Zhang

  • San Francisco Bay Area
View GitHub Profile
@Nan-Zhang
Nan-Zhang / gist:7603980
Created November 22, 2013 17:45
Genomix-Data DriverUtils
/* Properties类继承了Hashtable<object, object>, 隶属于Java.util package */
/* Properties可以load 文件流, 但文件的格式是line-oriented, 就是一行一个属性,
key=value,中间无空格*/
/* System.getProperty("app.home"), 是利用java 执行时的设置系统变量option, -Doption=value
(command line)*/
public static void updateCCProperties(GenomixJobConf conf) throws FileNotFoundException, IOException, InterruptedException {
Properties CCProperties = new Properties();
CCProperties.load(new FileInputStream(System.getProperty("app.home", ".") + File.separator + "conf"
+ File.separator + "cluster.properties"));
}
@Nan-Zhang
Nan-Zhang / gist:7603991
Created November 22, 2013 17:46
boolean.parseBoolean for a string
/* parseBoolean 能解析 string to boolean, 若string = “true” 就为true,反之亦然; conf.get()
返回一个string, 尽管FOLLOWS_GRAPH_BUILD 属性是Boolean */
followingBuild = Boolean.parseBoolean(conf.get(GenomixJobConf.FOLLOWS_GRAPH_BUILD));
@Nan-Zhang
Nan-Zhang / gist:7604002
Last active December 29, 2015 02:59
Genomix-Driver 148line
/* Patterns 是一个静态enum, arrayFromString()返回一个enum数组,注意遍历style*/
for (Patterns step : Patterns.arrayFromString(pipelineSteps)) {}
@Nan-Zhang
Nan-Zhang / gist:7604006
Created November 22, 2013 17:48
同时 引入2个driver类
/* 如果同时引入2个driver类, 因为分不清,则可以写全名*/
private edu.uci.ics.genomix.hyracks.graph.driver.Driver hyracksDriver;
private edu.uci.ics.pregelix.core.driver.Driver pregelixDriver;
@Nan-Zhang
Nan-Zhang / genomix_16
Created December 29, 2013 23:40
how to run pregelix-core-balancer
hadoop jar pregelix-core-0.2.3-SNAPSHOT-balancer.jar /user/nzhang/test.txt /user/nzhang/good 4
@Nan-Zhang
Nan-Zhang / Eclipse Templates
Last active January 4, 2016 15:29
How to use editor templates for MacEclipse.
Eclipse-Preferences-Java-Editor-Templates.
1. the shortcut of editor templates is ctrl + space, however, this shortcut had conflict with system spotLight's shortcut.
2. System->spotlight, then turn off the shortcut
eg,"sysout"coud genereate “System.out.println()","foreach" could generate for Loop framwork.
@Nan-Zhang
Nan-Zhang / ShortCut For Google Doc
Created February 9, 2014 02:02
For shortcut about switch bullets in Google Doc or PPT
1. Tab go from parent bullet to child bullet
2. Shift + Tab go back from child bullet to parent bullet
3. Shift type letter without new bullet
@Nan-Zhang
Nan-Zhang / TeXmacs
Created February 23, 2014 06:10
TeXmacs shortcut
1. Notice that the TeXmacs menus and keyboard behavior are contextual, i.e. they depend on the current mode (i.e. text mode or “math mode”). eg. >= this shortcut can be applied only when current mode is math mode(expression)
2. When using the F1, F2, ..., F12, these keys have conflicts with OS. So please add fn + Fx to remove the conflicts when using these keys.
@Nan-Zhang
Nan-Zhang / Mac Keyboard Symbols
Created February 23, 2014 06:12
Mac Keyboard Symbols
^ key: Control key. This acts like a normal control key
@Nan-Zhang
Nan-Zhang / Java Var Scope
Created March 1, 2014 23:47
The scope for static and local variables in Java
TreeNode prev = null;
public void inorder(TreeNode root, ArrayList<TreeNode> t, TreeNode prev) {
//do sth with prev (Note: this prev is the local variable, and has nothing to do with the static prev)
}