- 博客(335)
- 资源 (5)
- 收藏
- 关注

转载 高三才学会1元1次方程的美国人是如何战胜 勤劳勇敢 的中国人的
..........我们从小就被应试教育束缚着,老师要求我们向“愚公移山”的主人公愚公学习,所以,我们的国人付出了大量的努力,从事愚公移山式的制造业,我们成为了世界廉价劳动力工厂,竟然还有人说这是“中国的骄傲”。有些人又问了,那么,李智先生,要是我跟上面那SB似的,也开发一个程序做题,那我考试不及格怎么办?如果大家这样想,我只能说,应试教育对你的影响太大了,我劝有这样想法的人阅读完
2011-10-24 07:44:32
774
原创 Simple Web Application using Cherrypy in Python 3.3 with MySQL
import cherrypyimport mysql.connector as mconnectorimport sys# Globalglobal connglobal curtry: conn = mconnector.connect(user='test', password='test1234',
2014-07-18 20:47:29
1440
翻译 大数据:应用于计量学的新技巧 - 第三章 一般为预测需要做的考量
第三章 一般为预测需要做的考量一般来说,预测的目标是使用那些样本外的输入值也能够达到良好的预测结果。从我们的经验上看,对于样本内的输入值来说,建立一个能用的“预测机”十分简单,但不幸的是对于样本外的基本都没法用。举个小例子,n个线性独立回归因子可以完美的拟合n个观察值,但是对于预测样本外的输入值来说就完了。机器学习的专家们称这个现象叫做“过度拟合问题”,当然他们对这个问题也有一些解决方
2014-05-04 06:38:56
1212
翻译 大数据:应用于计量学的新技巧 - 第二章 用来分析大数据的工具
第二章 用来分析大数据的工具大数据处理的结果其实往往是一个人能看明白的“小”数据表,能被丢进普通的SQL数据库,统计系统或者电子表格进行显示或者再处理的。如果挖掘出来的数据还是很“大”,那么就需要用一些子样本来进行统计分析。在谷歌工作中,我发现随机提取样本的中0.1%作为子样本用来做业务数据的分析效果是不错的。 一旦数据被挖掘出来,常常需要对这些数据进行一致性清理(比如美国在英
2014-05-04 06:37:39
1340
翻译 大数据:应用于计量学的新技巧 - 简介以及第一章 用来处理大数据的工具
很久没有翻译文章了,今天偶然看到了谷歌首席经济学家 Hal Varian 的一篇文章,感触很深,决定将这篇文章翻译成中文提供给大家参阅。如果翻译有误欢迎大家指正。另:文章尽量不会逐字逐句的翻译,而是尽可能的翻译文章的含义,如果您对这篇文章感兴趣,请参阅:http://people.ischool.berkeley.edu/~hal/Papers/2013/ml.pdf- Ye Tian, 20
2014-05-04 06:34:49
1951
转载 Java Persistence/Persisting
http://en.wikibooks.org/wiki/Java_Persistence/PersistingPersistingJPA uses the EntityManager API for runtime usage. The EntityManager represents the application session or dialog with th
2014-04-01 21:31:53
979
原创 Temporary solution: LookupError: no codec search functions registered
REF: http://stackoverflow.com/questions/14627492/how-to-encode-unicode-string-into-utf-8-string-in-pythonEXEC:u.encode('utf-8')ERROR:LoopupError: no codec search functions registered
2014-03-03 22:51:59
4985
转载 Getting error headers with urllib2
http://stackoverflow.com/questions/6402051/getting-error-headers-with-urllib2e has undocumented headers and hdrs properties that contains the HTTP headers sent by the server.
2014-02-26 19:47:25
770
转载 Parsing Twitter Timestamp in Java
public static Date getTwitterDate(String date) throws ParseException { final String TWITTER="EEE MMM dd HH:mm:ss ZZZZZ yyyy"; SimpleDateFormat sf = new SimpleDateFormat(TWITTER); sf.setLeni
2013-12-16 22:31:51
731
原创 Improving performance of reading text from a large text file
KEYNOTE: Using containers such as StringBuilder and ArrayList instead of String.Before: try { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f),"utf-8"));
2013-12-16 22:13:36
728
原创 How to display Chinese/Japanese (Unicode) Character on Windows
[Question]I have been asked for many times how to correctly display, lets say Chinese Character, on Windows, thus I simply put the solution here for anyone who might meet the same problem :)[Inter
2013-12-14 00:23:24
1489
转载 Read Unicode characters from command-line arguments in Python 2.x on Windows
Ref:[1] http://stackoverflow.com/questions/846850/read-unicode-characters-from-command-line-arguments-in-python-2-x-on-windows/846931#846931[2] http://code.activestate.com/recipes/572200/R
2013-12-13 21:07:01
932
原创 Python: import Module and Class
Module: function_set.pydef print_function( name ): print "hello, %s" % name; return Class: Person.pyclass Person: ''' classdocs ''' name = ""; age = 0; gender =
2013-11-29 21:09:11
1507
原创 Example code of searching in WordNet Dictionary with JAWS library
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package testwordnet;import edu.smu.tspell.wordnet.NounSynset;import edu.smu.tspell.wordnet.Synset
2013-10-28 05:58:12
866
原创 A minimal example for creating a StanfordNLP Parser
Properties props = new Properties(); props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
2013-08-12 19:55:46
1257
原创 GARCH MODEL in R, Sample Code for GARCH(1,1)
# load datagarch_data <- read.csv(".../test_garch.csv", sep = ";")garch_data_close <- garch_data["Close"]# logarithmizegarch_data_close_ln <- log(garch_data_close)# ln(Pt) - ln(Pt-1)y2008ln1
2013-06-22 03:45:10
2315
原创 新建服务器后的常用命令
新建服务器后, 总是要做一些初始化的步骤, 往往需要一些常用的命令. 但是因为这些命令在初始化后基本上就不再用了, 真重新建立服务器了还要去 Google... 于是记录在这里.1. ssh建立好服务器后, 第一件事情是安装 openssh-server.2. 添加用户useradd USER_NAME -G GROUP_NAME -d /home/USER_N
2013-04-18 01:23:26
1105
原创 Hello World in D Language
import std.stdio;import std.conv;void main(string[] args){ if(args.length > 1) { string s = args[1]; int i = to!int(s); writefln("I will write %d time(s) Hello World!" , i); for(i
2013-02-08 00:22:55
668
转载 How to Make Dialogs
http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html#inputA Dialog window is an independent subwindow meant to carry temporary notice apart from the main Swing Application Window.
2012-12-06 00:08:10
738
转载 How to detect Safari, Chrome, IE, Firefox and Opera browser?
http://jsfiddle.net/9zxvE/http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browservar isOpera = !!(window.opera && window.opera.version); // Opera 8.0+
2012-12-03 20:05:41
815
原创 Writing IEEE articles in Chinese with TeX
\documentclass[conference]{IEEEtran}\usepackage{cite}\usepackage{graphicx}\usepackage{CJKutf8}\begin{document}\begin{CJK*}{UTF8}{gbsn}%在这里打中文咯\clearpage\end{CJK*}\end{document}
2012-10-15 17:32:40
706
转载 LaTex Templates and Samples for Writing IEEE Conference Paper
Main (http://quicklatex.blogspot.de/2011/12/how-to-use-latex-to-write-conference.html)\documentclass[conference]{IEEEtran}\usepackage{cite}\begin{document}\title{Sample IEEE paper style using
2012-09-19 21:51:45
2404
原创 数据驱动的种萝卜方法
从前有一群小白兔,他们辛勤的种萝卜。有一天他们发现他们种的萝卜不是太少无法满足兔子们的需求,要不就是太多放在仓库里面烂掉了;萝卜的质量也是参差不齐的,小白兔们需要的是好吃的萝卜,但有些萝卜种出来后就是个翔,让兔子们各种没有食欲。于是他们打算寻找方法来解决种萝卜的数量以及质量的问题。我们这里将介绍数据驱动的种萝卜方法。小白兔们其实要解决到底种多少好的萝卜才能满足兔子们的需要。
2012-09-05 22:00:32
1163
转载 局部搜索,模拟退火,遗传算法,禁忌搜索的形象比喻
为了找出地球上最高的山,一群有志气的兔子们开始想办法。 1.兔子朝着比现在高的地方跳去。他们找到了不远处的最高山峰。但是这座山不一定是珠穆朗玛峰。这就是局部搜索,它不能保证局部最优值就是全局最优值。 2.兔子喝醉了。他随机地跳了很长时间。这期间,它可能走向高处,也可能踏入平地。但是,他渐渐清醒了并朝最高方向跳去。这就是模拟退火。3.兔子们吃了失忆药片,并被发射到太空
2012-08-22 22:15:28
1280
原创 Use StringBuilder to create large string
Sometimes we use this way to get string from a file locally or remotely: String resultData = ""; // 使用循环来读取获得的数据 while (((inputLine = buffer.readLin
2012-08-02 06:57:24
584
原创 数据驱动软件工程,是时候把它召唤回来了
前阵因为论文看到过有关驳数据驱动的文章。的确,数据驱动方法存在一些问题。在90年代,Google 曾经做过一个实验,将程序员分成2组,一面教授模型驱动设计,另一面教授的是数据驱动设计。结果是,学习了数据驱动设计的开发者的代码冗余性提高,拓展性降低。就是所谓的低内聚高耦合。不过,那是90年代。回过头来看看现代的软件开发。首先,软件开发从原先的经典开发方法改变到了现在的持续性开发方法。其次,最终用户已
2012-07-18 06:23:18
1208
转载 Profiling in MYSQL
http://dev.mysql.com/doc/refman/5.0/en/show-profiles.html13.7.5.29. SHOW PROFILES SyntaxSHOW PROFILE [type [, type] ... ] [FOR QUERY n] [LIMIT row_count [OFFSET offset]]type:
2012-06-29 22:18:31
639
原创 How to convert CSV into Database Table?
CSV file:COL1;COL2;COL31;2.1;a2;2.2;b3;2.3;cthe first line will be the column names, the rest of the data will be the content.1. recognize data type2. get table columns3. create "create t
2012-06-28 23:49:55
567
原创 How to get the tables of one schema?
public ArrayList doGetDBTable(String schemaName) throws Exception { java.sql.DatabaseMetaData meta = conn.getMetaData(); java.sql.ResultSet schemas = meta.getTables(null, schemaName.toUpperCas
2012-06-28 23:43:41
551
原创 关于 XML 解析中的 setNamespaceAware
这个其实很 tricky如果你需要让 DOM 解析的时候 NamespaceAware,就将这个值设置为 true这个时候 root 中的 xmlns 会起作用但是!在处理单个文件的时候,有的时候这货很 scheisse 。。。所以将这个值设置为 false 不理会域名空间就可以了。
2012-06-20 00:27:30
2897
原创 Calculate Information Entropy
public double iEntropyDS(int[][] dataSource, int from, int to) { double e = 0.0; double col = dataSource.length; double row = dataSource[0].length; double totalElement = col * row;
2012-06-19 01:33:27
761
原创 Increasing performance of inserting large amount of data simutaneously.
String sql;PreparedStatement ps;System.out.println("please wait...");Date dt1 = new Date();sql = "INSERT INTO TABLE(COLUMNS) VALUES (?,?,?,?,?,?,?,?,?)"; ps = conn.prepareStatement(sql);for
2012-06-08 23:19:08
672
原创 无法安装 rJava 的解决方法
安装 R 后,如果你想安装 rJava,可能会遇到一个问题configure:4130: error: Cannot compile a simple JNI program. See config.log for details.打开 config.loginterpreter : '/usr/lib64/jvm/java/jre/bin/java'archiver : '
2012-05-16 22:07:58
3649
原创 Dependency Walker
If you get an error like this in R when initializing rJava:Error occurred during initialization of VMUnable to load native library: Can't find dependent librariesUse dependencywalker to find out
2012-05-09 22:50:29
671
原创 Web.xml in REST
如果想要在 Restful 的工程中同时添加 html 等,一定不要将 restful 的servlet 的 path 设定为 /* ,而是/something/* 这样就可以了。
2012-05-07 22:40:47
860
原创 Get 415: Unsupported Media Type when posting something to Restful WS
if you have a restful ws written like this: @Path("/doadd") @POST @Consumes("application/x-www-form-urlencoded") @Produces({MediaType.TEXT_HTML}) public String doadd(@FormParam(
2012-05-02 23:42:19
2748
原创 Add new function to a prototype in javascript
// add escape function to StringString.prototype.escape = function() { return this.replace(/&/gm, '&').replace(//gm, '>');};
2012-05-02 23:15:03
668
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人