Firefox 4 Linux 64bit binaries … exists!

I recently downloaded Firefox 4 RC1 from the official Mozilla site (before that I used the daily Minefield PPA repository). The Mozilla site does not ask you for 32bit or 64bit when pressing “Free Download”. I simply took what I was getting and at first my new Firefox 4 seemed to run fine. Then I recognized that Flash is not available (even if under other browsers it worked correctly). Also downloading the 64bit preview of Flash and trying to put it in many many firefox directories (like ~/.mozilla/plugins ~/bin/firefox4/plugins) didn’t help. After a while I read somewhere that a 64bit Firefox 4 version exists on the Mozilla FTP server. I downloaded it from there, used that version and voila … Flash (and all other plugins) are working again now.

So you 64bit Linux users, don’t let you fool yourself by the Mozilla website and grab the 64bit version from the FTP server.

Autocompletion / autosuggestion using Solr

There are several options available for getting autocompletion/autosuggestion to work with Solr. Below is an overview of these options and their advantages respectively disadvantages. If you have a question about one of these techniques then please feel free to leave a comment (just added DISQUS as comment system to my blog).

I will write another blog post the upcoming days about the “Combine faceting and query of (Edge)NGram filtered text” approach. This technique is not described in the resources below and actually the one I currently use.

(Edge)NGram filtering + text query

Pro:

  • Supported by stable Solr (1.4.x)
  • Results sorted by best match
  • Prefix query support using EdgeNGram filter
  • Infix query support using NGram filter

Contra:

Ticker – a jQuery UI Twitter like ticker

When you are not logged into Twitter and visit the start page an elegant live ticker shows up. I also wanted something like this, so I created one on top of the jQuery UI framework. In the most simple way (just rotating) you can create it on a div containing a list

<div id="ticker">
  <ul>
    <li>Ticker Item 1</li>
    <li>Ticker Item 2</li>
    <li>Ticker Item 3</li>
  </ul>
</div>

by just calling

$("#ticker").ticker();

The ticker has also some configuration options (like mouse over timeout, scroll speed, and so on) and nicely integrates with fetching new ticker items by using Ajax requests. A styled demo is available here.

It is well configurable and the code is fully tested using qUnit. The code (MIT/GPL license) and further documentation is available from the GitHub repository (Branch “ticker”).

Update attributes and OpenStruct

Rails does have the conveniet method update_attributes to update one or more attributes of an ActiveRecord instance. Sometimes this is also very handy for standard Ruby objects and pretty easy to implement:

class MyClass
  attr_accessor :foo, :bar
 
  def update_attributes(hash)
    hash.each_pair do |key, value|
      begin
        self.send("#{key}=", value)
      rescue
        # do something when an attribute does not exist
        # or simply ignore it
      end
    end
  end
end

Read the rest of this entry »

Shindig 2.0 Java on Ubuntu with Tomcat

Yesterday I blogged about how to install Shindig 2.0 PHP on Apache. Today we will do the same with Shindig 2.0 Java on Tomcat. This is even easier. This again should work at least on Ubuntu 10.04 and 10.10.

  • Install Tomcat
apt-get install tomcat6
  • Stop tomcat server (it was automatically started by Ubuntu)
sudo /etc/init.d/tomcat6 stop

Read the rest of this entry »

Shindig 2.0 PHP on Ubuntu with Apache

This is a little step by step instruction how to install the OpenSocial Shindig 2.0 PHP container on Ubuntu with Apache. This should work at least on Ubuntu 10.04 and 10.10.

  • Install Apache and PHP (together with some PHP Shindig dependencies)
sudo apt-get install apache2-mpm-prefork libapache2-mod-php5 php5-common php5-cli php5-curl php5-mcrypt
  • Enable the Rewrite module for Apache
sudo a2enmod rewrite

Read the rest of this entry »

MetaMap UIMA Version 0.4

Today I released MetaMap UIMA Version 0.4. It is a wrapper to make MetaMap easily accessible as a Apache UIMA component. I developed it for a bigger biomedical NLP project named PubCurator (but it is completely independent from it).

MetaMap UIMA can use a local installed MetaMap application (available for Linux and MacOS) or the MetaMap webservice at SKR. The full documentation of MetaMap UIMA can be found at the MetaMap UIMA Wiki.

Eclipse databinding without Eclipse

One can use Eclipse databinding also outside of Eclipse (for standalone SWT applications). In that case a Realm must be generated manually:

public static void main(String[] args) {
  Realm.runWithDefault(SWTObservables.getRealm(Display.getDefault()), new Runnable() {
    @Override
    public void run() {
      // Run your code with Eclipse databindings.
    }
  });
}

Dynamic menus and toolbar contributions

There are two options to add dynamic menus or toolbar contributions to an Eclipse RCP application.

  • Use the fill* methods of ApplicationActionBarAdvisor to add a manager (like a MenuManager). After changes call update(true) on the manager so that the changes will get visible in the UI.
  • Use the IMenuService:
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class);
AbstractContributionFactory factory = new AbstractContributionFactory("toolbar:org.eclipse.ui.main.toolbar", null) {
  @Override
  public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
    Action action = new Action() {
      @Override
      public void run() {
        System.out.println("hello");				
      }
    };
    action.setText("hello");			
    ToolBarManager toolBarManager = new ToolBarManager();
    toolBarManager.add(action);			
    additions.addContributionItem(new ToolBarContributionItem(toolBarManager), null);
  }
};	
menuService.addContributionFactory(factory);

Casting arrays

As Java is a static typed language the below code is not working (even if objArr contains only Strings):

Object[] objArr; // filled with strings.
String[] strArr = (String[]) objArr;

One workaround is this:

String[] strArr = Arrays.asList(objArr).toArray(new String[0]);

Another solution (faster for large arrays):

Object[] objArr; // filled with strings.
String[] strArr = new String[objArr.length];
System.arraycopy(objArr, 0, strArr, 0, objArr.length);