Posts

Showing posts from July, 2011

Orion PHP Support demo

Image
If you're following Eclipse planet , you couldn't have missed Karol Gusak's weekly status reports about PHP support that's being built for Orion. If you still haven't tried PHP in Orion yourself, here's a little demo now on YouTube that nicely shows syntax highlighting, content-assist as well as overall PHP experience in Orion. Click below to check it now.

Making extensible GUI with org.eclipse.ui.menus

Image
It's actually first time I had to make a custom part of GUI extensible. In an Eclipse forms editor like following, we wanted custom actions to come from various plugins: Since eclipse APIs provides this sort of extensibility with their org.eclipse.ui.menus extension point, I looked at how to reuse that mechanism. It turns simple. All you need to do is, while creating the editable area, add: final Composite parent = ... // that's the area we want to make extensible ContributionManager contributionManager = new ContributionManager() { public void update(boolean force) { for (IContributionItem item : items) { item.fill(parent); } } }; IMenuService service = (IMenuService) getSite().getService(IMenuService.class); contributionManager.add(new GroupMarker("testing")); service.populateContributionManager(contributionManager, "toolbar:org.zend.editor1?after=testing"); contributionManager.update(false); Now to contribute something to that area, you

Starting and immediately using OSGi bundle: possible?

Lately I had this little thing to do: an OSGi bundle (SuperTool) comes with some other OSGi bundle (GreatSdk) included. SuperTool depends on logic in GreatSdk so the first thing it needs to do during activation is to install GreatSdk and immediately after that start loading classes from GreatSdk. At first thought it seems logical to make SuperTool-GreatSdk dependency optional, to let SuperTool install and start safely without GreatSdk. Once installed, during startup SuperTool should install GreatSdk and start using it, for example: BundleActivator.start(BundleContext context) { greatSdk = context.installBundle("file:///path/to/great.sdk_1.0.0.jar"); greatSdk.start(); GreatSdkStarter gss = new GreatSdkStarter(); // separate class in SuperTool that references some classes from GreatSdk gss.start(); // creates some GreatSdk classes } Unfortunately this fails in gss.start() with ClassNotFoundException: java.lang.ClassNotFoundException: greatSdk.Sdk at org.eclipse.osgi.internal.lo

Installing V8Cgi on Mac

V8CGI is a very thin Apache module encapsulating V8 - Google's JavaScript engine that's used e.g. in Google Chrome. Those concerned with NodeJS stability may consider V8CGI a better choice, thanks to stability provided by Apache base. A short while ago, on DevMeetings.pl DevCamp we've been playing with V8CGI, RingoJS and Node. Thanks to good performance , intuitive and high quality APIs , V8CGI turned out to be the black horse of the whole event, although installing it on Macs was little tricky. Readers with Windows and Linux should follow to V8CGI home page , where they can get precompiled Windows binary and learn how to install binary on Ubuntu . Mac users, let's open terminal and try to build the V8 apache module ourselves. Getting V8CGI to work is four steps: 1. Getting the source code 2. Building it 3. Configuration 4. Test drive 1. Getting the source code When checking out sources from SVN, we actually need two packages V8 and V8CGI: a) svn checkout http://v8cgi

Search by multiple keys in CouchDB

While developing a simple Twitter clone on V8CGi + CouchDB stack, we faced an interesting problem. We have a CouchDB database with users and messages. Each user has many followers and he'd like to see messages from all these followers. So we need to query tweets database for all documents that have author belonging to the list. In SQL it's something as simple as: SELECT * FROM tweets WHERE author IN ("szymon", "wiktor", "marek") SORT BY timestamp; In CouchDB it turned out to be an open issue https://issues.apache.org/jira/browse/COUCHDB-523 As far as I remember we ended up with running two separate queries. I'd be happy to hear how others solved this!