yourpalal's blog

Back from Auckland

Blog post by yourpalal on Thu, 2012-05-03 16:51

With one big push the work I did on ALM (Auckland Layout Model) while I was at the University of Auckland is now in the main Haiku repo. In short, I’ve brought the BALMLayout up to standard with the other layouts in Haiku, and added some new features as well.

Haiku on Java

Blog post by yourpalal on Thu, 2012-03-01 22:36

As part of my work at the University of Auckland (which is drawing to a close soon) I have been looking at Java on Haiku. There is already some support for Java on Haiku. By running installoptionalpackage DevelopmentJava you can get the JamVM java virtual machine, GNU Classpath (including gjar, gjavah and maybe some other utilities), and ecj (the Eclipse Java compiler, which is written in Java). This is enough to run and compile basic Java apps. For instance, the popular Java buildtool Ant can run on Haiku.

Anyway, the reason I was investigating this is because the University of Auckland has a big Java library (a database, actually) that has been developed here, and Christof and Gerald (my supervisors) want to bring it to Haiku. To do this, we require the ability to write code that integrates with both Java libraries, and the Haiku API. I looked at various solutions:

  • gcj compiles Java to C++, but seemed like too big of a port
  • Java Native Interface (JNI) allows for writing C++ code that hosts a JavaVM and calls Java code, but is tedious to write.
  • SWIG can generate Java bindings to C++ libraries, even allowing Java classes to inherit from, and override virtual methods in, C++ classes.

SWIG is a mature solution that handles writing lots of JNI code, and the input files are pretty much just C++ headers, so it doesn't require too much tedious work. Given these points, I decided to go with SWIG, and I have put the results (so far) on Github.

Currently, I have two tests, one that runs a custom handler on the BApplication thread (also works running it on an extra BLooper) and listens for messages. The other test makes a very simple GUI using the Haiku API. Check out the result of this test in the image on the right. That's a BWindow with a BButton and a BGroupLayout and a BStringView, all created with Java code!!!

There are still some issues, but I'm really excited about the progress that I've made already, and I'm very impressed with SWIG! As I said in the README on Github, having Java bindings also opens up the door for any JVM language to use the Haiku API, for instance Jython, JRuby, and Scala to name a few. If you're interested in contributing, head over to github and fork the project. If you just want to try it out, it's really easy to do that, there are instructions on github in the README.

Tales From the Land of Auck and Zea

Blog post by yourpalal on Thu, 2012-02-16 21:42

As was announced a little while ago, I recently got the opportunity to travel to Auckland, New Zealand to do some Computer Science research at the University of Auckland (UoA) with Christof Lutteroth and Gerald Weber (two professors here). Actually, it's not so much 'recently' as it is 'currently', since I'm still here! Christof has been interested in Haiku for a while, and has already done some research using Haiku. Stack and Tile, for instance, started as a research project here, as did the BALMLayout layout class. Furthermore, I'm not the only Haiku-er here, as Clemens Zeidler is currently working on his PhD in CS under the supervision of Christof and Gerald.

My supervisors have been very flexible with what I can work on, and we decided the first thing I should do is work on the BALMLayout. BALMLayout (ALM = Auckland Layout Model) is based on the idea of a constraint-based layout, where the programmer doesn't explicitly position elements, but rather describes how they must be positioned relative to each other or the layout area, and ALM figures it out. Since the code for BALMLayout was written before I started working on Haiku's layout API, BALMLayout had fallen behind a bit. So one thing I worked on was getting it up to date with the API. There were also a few things that BALMLayout was doing a bit differently from the other layout classes, which I've now normalized. I've also implemented a layout builder class for ALM, like the ones that exist for other layouts. The end goal is to have BALMLayout promoted to be a first-class layout, included in, like the Grid, Group, and Card layouts. Although I've already written a bunch of code, I haven't yet pushed it to the main Haiku repo, but that's something I hope to do soon.

The next project I'm working on is pretty interesting in a few ways, as it includes running and compiling Java code on Haiku (using JamVM, GNUClasspath, and Eclipse's ecj compiler), and calling Java code from C++ as well (using JNI). Although this work is more experimental, it should pave the way for using PDStore, a triplestore database developed at the UoA on Haiku, basically making it available to C++ programs as a library.

Now that you guys know what I'm up to, I want to thank everyone who helped make this trip possible: Haiku folks, UoA folks, my family and also Google (especially Carol Smith at the Open Source Programs Office), who provided me with a grant to keep things running smoothly.

Layout docs landing

Blog post by yourpalal on Sat, 2010-10-23 15:24

It's been a long time coming, and they're still not done, but I've committed some initial documentation for the Layout API. For the curious, you can access the documented classes here, there is also an introduction to building a GUI with the Layout API here. If you happen to find a typo, or inaccurate info, please contact me so I can fix it. Finally, note that, like the documentation, the Layout API is not yet finalized.

Unit Testing for Fun and Profit

Blog post by yourpalal on Fri, 2010-06-18 17:55

I noticed the other day that I had a comment below my previous blog post, I didn't have time to reply that day, the next day I was in bed sick, but TODAY, I can reply! In the comment, AndrewZ asked if I could post some of my unit testing code, and I thought that would make for an interesting blog post, and here one is.

Progress In the Layout API

Blog post by yourpalal on Fri, 2010-06-11 09:09

Here is my first blog post about my progress so far for my gsoc project, a little later than it should be, but at least it's here! So, what have I been working on? Two things, basically: archiving with cross-references, and view-less layouts. I've been chatting with my mentor and things are getting revised fairly quickly, so instead of writing about implementation, I'll write about the ideas and results of what I'm working on!

Taking the Haiku Layout API Public

Blog post by yourpalal on Wed, 2010-04-28 03:22

Project Outline

My GSoC project revolves around polishing and preparing Haiku's Layout API for public consumption. Currently, this is only supposed to be used in Haiku's included applications, so third party applications must manually position and resize all their GUI elements, which can be really tedious and inflexible. I will also be modifying some Haiku-provided applications to use the Layout API, which will help me find bugs and help with Haiku's ongoing localization.

Syndicate content