Tue 18 March, 2008

add to del.icio.us. look up in del.icio.us.
add to furlMon 17 March, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
“ Charlie Chaplin was no Harry Houdini. ”
Patrick Ewing, with no little feeling
add to del.icio.us. look up in del.icio.us.
add to furlSun 16 March, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
“ The real curse of software is that you can never take anything out. ”
Gilad Bracha speaking about mistakes made in designing Java
add to del.icio.us. look up in del.icio.us.
add to furlSat 15 March, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
“ Your job will never love you back. ”
Amy Hoy
add to del.icio.us. look up in del.icio.us.
add to furl
Old School Sesame Street on Abstract Thinking
add to del.icio.us. look up in del.icio.us.
add to furlFri 14 March, 2008

Like 10 million other iPhone fanboys, I applied for the Apple iPhone developer program. Today, one week after applying, I received this email
Thank you for expressing interest in the iPhone Developer Program. We have received your enrollment request. As this time, the iPhone Developer Program is available to a limited number of developers and we plan to expand during the beta period. We will contact you again regarding your enrollment status at the appropriate time.And I've seen lots of other people on Twitter complaining of getting the same email. One disappointed reject said this
Thank you for applying.
Best regards,
iPhone Developer Program
As I understand it, no one got in except for a handful of large partner companies alla Google.
It's bad enough that the "free SDK" isn't actually free since you have to pay $99 to be able to load your apps on your own iPhone, but now they're rejecting hopeful developers in bulk. They ought to let everyone in who wants in. What's the harm?
Gee... I wonder if I'm violating some NDA by blogging this? I'm sure some of the helpful souls on the xcode-users list will let me know if I am.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlThu 13 March, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
The $100 early-bird discount lasts until April 10th, but it seems like the open seats might not. So if you’re looking to meet up with the rest of the Rails community in Portland, you probably better get your registration in and your travel plans in line. It’s going to be a blast.
add to del.icio.us. look up in del.icio.us.
add to furl
Aptana has released RadRails 1.0 with a bunch of cool new features. I really like their debugging and profiling tools that allow you to inspect the call graph and see where the hot spots in your code are. The fact that RadRails is free and open source as well certainly doesn’t hurt.


add to del.icio.us. look up in del.icio.us.
add to furl
Funny Or Die is pulling high G’s scaling their Rails site to handle 9GBps of video and 20MBps of compressed HTML traffic from the stunts of Will Ferrell and others. Their top video has been seen no less than 50 million times. Rock on, guys.
add to del.icio.us. look up in del.icio.us.
add to furl
“ Patterns are just a technique. It’s what is in your heart as a writer that matters. ”
Kent Beck
add to del.icio.us. look up in del.icio.us.
add to furlWed 12 March, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
“ This is great but what’s the deal? ”
Steve Jobs pretending to be a 3rd party iPhone developer
add to del.icio.us. look up in del.icio.us.
add to furlTue 11 March, 2008

Weka,是一个用Java编写的数据挖掘软件。数据挖掘,从字面上来看,它是一个从数据中找寻有用信息的过程,不过,它涉及的内容很多,所以,这里借用“分类”这一面来说事。
分类,从名称上来看,再简单不过了,给你一样东西,给它分个类。你如何知道怎么分类呢?显然,这是基于你已有的经验。对于计算机而言,这种经验从何而来呢?只有让人来告诉它,也就是说,我们要拿一批数据训练计算机,经过训练的计算机,便具备了一定的识别能力,就可以完成一些简单的分类工作。现实中,可以用到分类的机会有很多,比如我之前,曾经参与过的一个项目就是用这种方法来做车辆的识别。
下面便是一段使用Weka完成一段分类程序。
import weka.classifiers.Classifier;
import weka.classifiers.bayes.NaiveBayesMultinomial;
import weka.core.Attribute;
import weka.core.FastVector;
import weka.core.Instance;
import weka.core.Instances;
import weka.filters.Filter;
import weka.filters.unsupervised.attribute.StringToWordVector;
public class Main {
private static final String GOOD = "G";
private static final String BAD = "B";
private static final String CATEGORY = "category";
private static final String TEXT = "text";
private static final int INIT_CAPACITY = 100;
private static final String[][] TRAINING_DATA = {
{"Good", GOOD},
{"Wonderful", GOOD},
{"Cool", GOOD},
{"Bad", BAD},
{"Disaster", BAD},
{"Terrible", BAD}
};
private static final String TEST_DATA = "Good";
private static Filter filter = new StringToWordVector();
private static Classifier classifier = new NaiveBayesMultinomial();
public static void main(String[] args) throws Exception {
FastVector categories = new FastVector();
categories.addElement(GOOD);
categories.addElement(BAD);
FastVector attributes = new FastVector();
attributes.addElement(new Attribute(TEXT, (FastVector)null));
attributes.addElement(new Attribute(CATEGORY, categories));
Instances instances = new Instances("Weka", attributes, INIT_CAPACITY);
instances.setClassIndex(instances.numAttributes() - 1);
for (String[] pair : TRAINING_DATA) {
String text = pair[0];
String category = pair[1];
Instance instance = createInstanceByText(instances, text);
instance.setClassValue(category);
instances.add(instance);
}
filter.setInputFormat(instances);
Instances filteredInstances = Filter.useFilter(instances, filter);
classifier.buildClassifier(filteredInstances);
// Test
String testText = TEST_DATA;
Instance testInstance = createTestInstance(instances.stringFreeStructure(), testText);
double predicted = classifier.classifyInstance(testInstance);
String category = instances.classAttribute().value((int)predicted);
System.out.println(category);
}
private static Instance createInstanceByText(Instances data, String text) {
Attribute textAtt = data.attribute(TEXT);
int index = textAtt.addStringValue(text);
Instance instance = new Instance(2);
instance.setValue(textAtt, index);
instance.setDataset(data);
return instance;
}
private static Instance createTestInstance(Instances data, String text) throws Exception {
Instance testInstance = createInstanceByText(data, text);
filter.input(testInstance);
return filter.output();
}
}
这个程序分成两个大部分,前半部分用以训练分类器,后半部分则是测试这个分类器。
训练分类器,我们要做的包括,选择分类算法和准备训练数据。在Weka中,每一种分类算法都是Classifier的一个子类,这样的话,就可以在不改变其它部分的情况下,很容易的修改分类算法。
其实,稍微了解一下这方面的知识的人,都会知道,分类算法固然重要,但真正决定一个分类器本事大小的,是用以训练的数据。想要得到一个好的分类器,少不了不断调整训练数据和不断的训练。这同人类认识问题是一样的,经得多,见得广,才有更好的分辨能力。
在Weka中,用以训练的数据就是Instances,顾名思义,这是Instance的复数,显而易见,单独的一个训练数据就是Instance,而Instances这个类的存在,可以把Instance的一些公共的属性放到一起。在这里,我们可以看到,为了用文本作为训练数据,我们会把文本转换为Instance。同样,测试分类器的时候,我们也会把文本转换为一个Instance,然后再进行分类。
除此之外,这里还有一个Filter的概念,同常见的filter概念类似,它给了我们一个进行正式处理之前,对数据进行处理的机会。在这里,主要是对Instance做一些相关的变换。
当我们得到一个分类器之后,就可以利用这个分类器进行分类了,其中,最关键的代码是
classifier.classifyInstance(testInstance);
这段代码返回的是根据分类算法计算结果得到的一个相似度,我们可以利用这个值来估计我们测试用的数据应该属于哪个分类。
从代码上来说,这段代码本身并不复杂。正如前面所说,一个好的分类器是需要让数据帮忙的。所以,换几个测试数据,你就会发现,这段代码中实现的分类器一点都不强大。如果希望它强大起来,扩展训练数据是一个必然的结果。不过,对于这篇blog而言,这不重要,因为我们只是要和Weka问个好,进一步的工作,还需要进一步的努力。
add to del.icio.us. look up in del.icio.us.
add to furl