A quick hint for compiling the LKC parser. The kbuild system requires that bison 2.3 is used. Newer versions (in my case, 2.4) generate code that throw a compilation error. ★
Arrived in Linz yesterday night by train. Getting from tram station to the hotel was difficult since the wheel’s didn’t really work with all the snow on the group. I had completely overlooked the fact that there might be snow when packing in Toronto. This shot was taken during the lunch break at the Vamos workshop today. The pond must have been deep since it was definitely below zero yet the water wasn’t frozen over.
Thorsten and Maria brought me to the Monument of the Battle of Nations today. I went with the expectation of seeing a statue, only to find this monolithic structure overlooking a frozen-over lake. It looked as if it could have been out of the Lord of the Rings.
Here’s a wicd template for the EAP-TTLS + PAP setup at the University of Leipzig. This was just a small customization of the template from Shawn MacLean, so all credit goes to him. Create the file /etc/wicd/encryption/templates/eap-ttls containing:
name = EAP-TTLS with PAP
author = Shawn MacLean
version = 1
require identity *Identity password *Password ca_cert *Path_to_CA_Cert
-----
network={
ssid="$_ESSID"
scan_ssid="$_SCAN"
proto=WPA
key_mgmt=WPA-EAP
pairwise=TKIP
group=TKIP
eap=TTLS
ca_cert="$_CA_CERT"
identity="$_IDENTITY"
password="$_PASSWORD"
phase2="auth=PAP"
}
Add eap-ttls to /etc/wicd/encryption/templates/active, restart the GUI and the settings should now appear in the dropdown menu.
I’ve been getting into photography lately, and it’s been quite an interesting process so far. It’s incredible how a photograph can capture all the little details that you just didn’t notice when you were there in person. I’m only at the start of this journey (or addiction)… it’ll be interesting to see where I end up a year from now.
I haven’t spent much time on this blog lately and now I’ve run into the classic migration problem. I’ll be slowly updating in the next couple days.
The Globe and Mail placed the Canadian Copyright reform bill on a wiki for users to edit. I think this is a great use of a wiki and gives us an opportunity to read up on our rights and (maybe) make a change. ★
Here’s a short guide for installing Confluence on a shared Tomcat server instance on Ubuntu 8.10. Apache Tomcat 6 can be installed using a simple apt-get command:
sudo apt-get install tomcat6
Next, we’ll need to raise the Tomcat heap size for confluence. Edit /etc/default/tomcat6 and add the line:
JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m $JAVA_OPTS -Djava.awt.headless=true"
Now, we’ll need to grant security permissions to the Confluence webapp. To do this, create a file /etc/tomcat6/policy.d/05confluence.policy and place the following text in it:
grant codeBase "file:${catalina.home}/webapps/confluence/-" {
permission java.security.AllPermission;
};
grant {
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "defineCGLIBClassInJavaPackage";
};
Finally, we can restart Tomcat using the command:
/etc/init.d/tomcat6 restart
References
I was debugging a seemingly random crash in some graph layout code. An hour later... feeling proud of myself for having fixed the problem, I wanted to file the problem in the bug tracker, only to find a bug report with the exact problem and resolution. Lesson learned: Always, always, check the bug tracker before trying to debug broken code yourself. ★
Computers fail again. The TSX halted its trading for an entire day due to problems with its data feeds. What sort of problem with data feeds could be so horrible to require an entire day to fix? Source. ★
Ever needed to find all k-combinations of a set? Of course! I’m pretty sure everybody has run into this problem one way or another, as part of your development work, a combinatorics assignment (eek!) or in every day life. For me, I needed to implement this for generating association rules. What better way to prototype my eventual Java implementation than to use Groovy.
def choose(def itemset, int choose) { def choose(def itemset, int choose) { def results = [] //Initialize indices int[] indices = new int[choose] for (i in 0..<choose) { indices[i] = i } boolean hasMore = true; while (hasMore) { def combo = [] for (i in 0..<indices.size()) { combo << itemset[indices[i]] } results << combo hasMore = { /* Closure to move the right-most index */ int rightMostIndex = { /* Closure to find the right-most index */ for (i in choose-1..0){ int bounds = itemset.size() - choose + i if (indices[i] < bounds) return i } return -1 }() // execute closure // increment all indices if (rightMostIndex >= 0) { indices[rightMostIndex]++ for (i in rightMostIndex+1..<choose) { indices[i] = indices[i-1] + 1; } // there are still more combinations return true } // reached the end, no more combinations return false }() // execute closure } return results }
I’ve based my implementation off one from Applied Combinatorics by Alan Tucker. First, there is an indice array that stores the k positions in the itemset. The items at these index locations are the k-combinations. The algorithm increases the right-most index until it reaches the last element of the itemset, then increases, the second right-most index and so on.
I wouldn’t recommend this implementation when dealing with large itemsets. A deficiency with this one-method approach is that a single list is constructed containing all of the combinations. This list can grow to be very large, very fast. It can be easily adapted to provide one combination at a time by refactoring the hasMore check into a separate method. This way, it would act like an iterator. It’s too bad that Groovy doesn’t have support for the do-while loop as well, otherwise the hasMore closure could have been factored out into a really cool while check.
Markers are a great feature of Eclipse and there are some great articles on creating Markers. However, I couldn’t find a good article on opening markers in an editor. So, here’s the best call sequence that I could figure out:
IJavaElement element = ...; IEditorInput input = EditorUtility.getEditorInput(element); IEditorPart editor = getSite().getPage().openEditor(input, (input instanceof FileEditorInput) ? : JavaUI.ID_CU_EDITOR : JavaUI.ID_CF_EDITOR); IDE.gotoMarker(editor, sNode.getMarker());
EditorUtility is an internal JDT class, but I couldn’t find a better way of doing this. A check on the return type of the getEditorInput call is necessary to since it can return either a file editor (for compilation units) or a class file editor.
The second trailer for the next Star Trek movie is out. I looks like quite an exciting action movie. The trailer almost has the same tone as the Transformers movie. Definitely not the Star Trek I used to know and love, but hey, I'm open to a series "reboot". ★
I’ve taken some time implementing Peter Norvig’s spelling corrector in an attempt to learn Groovy, a dynamic language that compiles to bytecode and is compatible with standard Java classes and libraries.
There are a couple differences (most likely deficiencies) with my implementation. First, I use a list instead of a set when constructing the candidate word list. Second, I created a separate occurrence function in order to provide the smoothing capability for our occurrence distribution. Third, I didn’t really care much for a low line count. It’s not the LOC that matter in the end, it’s how easily you can comprehend the code!
public class SpellingCorrector { def wordoccur = [:] def words(File file) { Scanner scanner = new Scanner(file) def words = scanner.findAll{ x -> x.toLowerCase() ==~ ~/[a-z]+/ } } def train(List words) { words.each { wordoccur[it] = wordoccur.containsKey(it) ? wordoccur[it] + 1 : 1 } } def edits1(String word) { def results = [] int n = word.length() //Deletion. Remove a character. for (i in 0..<n) results << word[0..<i] + word[i+1..<n] //Transposition. Swap adjacent characters. for (i in 0..<n-1) results << word[0..<i] + word[i+1] + word[i] + word[i+2..<n] //Alteration. Change one character for another letter. for (i in 0..<n) for (c in 'a'..'z') results << word[0..<i] + c + word[i+1..<n] //Insertion. Add a letter in between the others. for (i in 0..<n) for (c in 'a'..'z') results << word[0..<i] + c + word[i+1..<n] return results } def knownedits2(String word) { def candidates = [] edits1(word).each { candidates.addAll( edits1(it).findAll { wordoccur.containsKey(it) } ) } return candidates } /** * Smoothing distribution. If the word hasn't been encountered (novel words), * we give it an occurence value of 1. */ def int occurrence(String word) { return wordoccur[word] == null ? 1 : wordoccur[word]; } def List known(List words) { return words.findAll { wordoccur.containsKey(it.toLowerCase()) } } def correct(String word) { def candidates = [word] + known([word]) + known(edits1(word)) + knownedits2(word) return candidates.max { occurrence(it) } } }
First, we don’t attempt to split words into two sub-words. For example, a common typo may be “Ihave” rather than “I have”. Second, the training and known function can definitely be improved to with support for proper nouns, stemming, and more. I think it would be a fun exercise to try and to create a simple implementation of these features, much like the SpellingCorrector.
So, Groovy has great support for regular expressions, list construction and compositions and best of all, closures! I also had a chance to play with the Groovy NodeBuilder (on a separate program), which is a great way for constructing tree structures. All said and done, I would hate to implement this in Java.
I presented the paper "Sample Spaces and Feature Models: There and Back Again" by K. Czarnecki, S. She, and A. Wąsowski at this year's Software Product Line Conference.
Update: The slides for my presentation have been uploaded. Download them here: [download#9]. (0)
Abstract
Software systems have grown larger and more complex in recent years. Generative software development strives to automate software development from a systems family by generating implementations using domain-specific languages. In current practice, specifying domain-specific languages is a manual task requiring expert analysis of multiple information sources. Furthermore, the concepts and relations represented in a language are grown through its usage. Keeping the language consistent with its usage is a time-consuming process requiring manual comparison between the language instances and its language specification. Feature model mining addresses these issues by synthesizing a representative model bottom-up from a sample set of instances called configurations.
This thesis presents a mining algorithm that reverse-engineers a probabilistic feature model from a set of individual configurations. A configuration consists of a list of features that are defined as system properties that a stakeholder is interested in. Probabilistic expressions are retrieved from the sample configurations through the use of conjunctive and disjunctive association rule mining. These expressions are used to construct a probabilistic feature model.
I will be holding a seminar describing my Master's thesis work. It is open to all, so please attend if you're interested. Feature Model Mining. Wednesday, August 6 at 1:30pm in EIT 3145. Update: Here are the slides that I've used for my presentation. (0)














