Thursday, November 12, 2009

Eclipse SVN merge

When merging branch to trunk follow these steps:
  • Commit all branch changes to svn
  • Checkout trunk to workspace
  • Right-click on trunk project in workspace: Team -> Merge
  • In from url select branch to be merged to trunk
  • In to url check 'Use "From:" URL'
  • In from revision choose last revision to get from branch. Think about it, you want revision that has all the changes that were done since last merge to trunk
  • Click Merge
  • If there are any conflicts, they will show up in project file tree, resolve them by: Team -> Edit Conflicts... on the file in question.
  • Once conflicts are resolved, Team -> Marked Resolved... on the file.
  • After all conflicts are resolved, and everything works, commit!

Wednesday, October 28, 2009

SVN Hooks

I am working on a project where I need directory of my cakePHP application on the server update on each svn commit. Why? Because I am lazy. I don't want to login to remote server every time I commit something, run svn update...or worse ftp. So I've been reading about svn hooks, and it's a very powerful thing.

These are the steps to make it work:

  • Create and compile c program that will perform svn update, and save it somewhere let's say in /svn/autoupdate

    int main(void)
    execl("/usr/local/bin/svn", "svn", "update",
    (const char *) NULL);

  • Add post-commit to svnrepo/hooks where compiled c program is referenced:


  • chmod +x post-commit

Try to commit something to svn on remote server and watch svn hooks magic in action.

Tuesday, September 15, 2009

Install RMagick on Ubuntu

sudo aptitude install -y imagemagick
sudo aptitude install -y libmagick9-dev
sudo gem install rmagick

Bind a key binding that is already defined

To correctly bind a key that is already defined for example by platform - F5 for refresh, the important thing is to create your own context:

name="refresh" parentId="org.eclipse.ui.contexts.window">

Once correct context is defined, it needs to be activated. For example, in view:

View.createPartControl(Composite parent) {
IContextService contextService = (IContextService) getSite().getService(IContextService.class);

Then the usual, command is created that is tied to a handler that extends AbstractHandler, command is tied to a binding, and the binding is in turn uses earlier created custom context.

defaultHandler="com.iwaysoftware.explorer.handler.RefreshHandler" id="com.iwaysoftware.explorer.refreshCommand"

sequence="F5" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="com.iwaysoftware.explorer.refresh" />

name="refresh" parentId="org.eclipse.ui.contexts.window">

Saturday, September 12, 2009

Kill process that is using paricular port

Find process id and kill it

ruby@t61:~/dev/ruby/demo$ sudo netstat -lpn | grep 3000
[sudo] password for ruby:
tcp 0 0* LISTEN 5358/ruby
ruby@t61:~/dev/ruby/demo$ kill -9 5358

Monday, August 31, 2009

Disabling nodes in CheckboxTreeViewer

Working on a project at work I had to use CheckboxTreeViewer, one of the requirements was that some nodes in the tree are disabled. I thought that this would be easy enough because surely CheckboxTreeViewer has some method that I can call to disable some checkboxes. It turns out it does not.

The first thing I obviously did was googled for possible solution. Unfortunately the solutions were not what I needed, so I decided to try the problem myself. Luckily there are two methods that are of help in CheckboxTreeViewer: setGrayed and setChecked, setGrayed nicely grays out checkbox so the user knows that this checkbox is disabled.

Here is the code in pastebin, since it does not render well in my template.

The disable mechanism revolves around value in model's isEnabled field. My model is roughly based on example from this article, but any model will do as long as there is variable that sets a particular model element not enabled. Screen shot on the left shows how this code works in my application.

Eclipse 3.5 has interface ICheckStateProvider that pretty much does what I wanted to do here. However, I am currently at Eclipse 3.4, so will have to wait for this once I move to 3.5.

Tuesday, June 2, 2009

Open Video takes on Adobe Flash Player

One of the proposed new features in HTML5 is "native" video player. has a demo of the player and it look pretty good.

The problem I have with Flash is...well the fact that I have to install it. With Open Video as it is called there is nothing to install, player works naively if you will. The cool thing about the player and the fact that it is basically an HTML tag is that you can you style sheets to shape the player as you wish, apply different filters on the video and array of other different things I suppose. However the most amazing thing about the player is that it is fast!

The only thing that will slow down growth of this in current browsers is Ogg Theora codec. This codec is only supported by FireFox 3.5, so if you cannot see the video it means you are not running that browser version.

Nevertheless, Open Video is very exciting news and I look forward for it to be adapter by the industry.

More information about video element can be found here.

Thursday, May 28, 2009

Set default java on Ubuntu

$JAVA_VERSION = where java is installed (/usr/lib/jvm/java-1.5.0-sun)
sudo update-java-alternative -s $JAVA_VERSION

java version "1.5.0_18"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18-b02)
Java HotSpot(TM) Server VM (build 1.5.0_18-b02, mixed mode)

Thursday, May 21, 2009

ИскаBoo starts its life

The eBook project is in the works and enjoys its new home. Why ИскаBoo(IskaBoo) you might ask? Well it's a play on two words, Russian искать which means to search and Boo which is English Book without the 'k'. Sounds nice, don't you think?
So the first conversion I am doing is actually from LRF to PDF just because there are libraries available for the conversion: LRFTools. Yes, I wanted to implement fb2 to lrf first, but I'd like to finish UI part first so that I have extension point correct to contribute to conversion. The extension point here is this:

name="LRF to EPUB Converter"
outputtype="epub" providerclass="free.akravets.iskaboo.ui.coverter.lrttools.LRF2EPUBConverter">

So here a plugin that wants to contribute to conversion mechanism will implement this extension point and provide implementation of IEBookConverterProvider interface:

public interface IEBookConverterProvider {
public URL convert(URL inputDocument) throws MalformedURLException;

Of course this interface is not 100% set, but basic conversion from LRF to PDF almost works.

Friday, May 15, 2009

eBook Tools for Eclipse

I recently discussed available solutions for eBook conversions. Then I decide why not create Eclipse plug-in that would tackle this task as well? I chose Google Code as my source code repository - it's actually quite nice (what isn't from Google, right :) ). There is nothing major there right now - only project / import wizard and an extension point, but I am excited to start working on the real code that will make this plug-in tick. My first item on the list will be creating fb2 to epub coversion.

Thursday, April 30, 2009

Calibre: open source to the rescue

About six month ago I bought my wife Sony PRS-505 eBook reader for her birthday. She uses it mainly to read Russian books. My home computer is dual boot Ubuntu/Windows machine, Ubuntu being the primary OS. When my wife downloads Cyrillic books they are in fb2 format and I prefer lrf for Sony Reader. So what I've been doing is sending downloaded books to my Dropbox and picking them up and converting once I am in Windows. Yes, I could have told my wife to use Windows when she downloads books, but I rather she uses Ubuntu, for obvious reasons.

Today I decided that this is enough and started looking for what is available on Ubuntu - I found Calibre. This is exactly what I was looking for! Calibre does exactly what I wanted - catalog my eBooks, convert between different formats and tons of other things that I have not tried yet. Open source wins again!

Tuesday, April 28, 2009

Harvesting eclipse icons

Found this useful script here. Pasting it here so I don't loose it. Really useful stuff.

export CVSROOT

mkdir -p eclipse
cd eclipse
cvs -q co org.eclipse.debug.ui/icons
cvs -q co org.eclipse.pde.ui/icons
cvs -q co org.eclipse.jdt.ui/icons
cvs -q co org.eclipse.vcm.ui/icons
cvs -q co
cvs -q co org.eclipse.ant.ui/icons
cvs -q co
cvs -q co org.eclipse.ui/icons
cvs -q co org.eclipse.ui.views/icons
cvs -q co org.eclipse.ui.console/icons
cd ..
rm -f ~/public_html/
find eclipse -name "*.gif" -print | zip ~/public_html/ -@

Thursday, April 23, 2009

Fast Ubuntu server

Whenever I try to download new Ubuntu release, fast download server is the key to enjoy the OS goodness. seems to be the fastest one I've seen at 3-4 MB/sec.

Monday, April 20, 2009

Zooming in GEF Editor and Connections

Recently I was faced with an issue in GEF Editor where when I was making a connection between to figures and scaling was less than 100%, the connetion feeback would be shown relative to figures coordinates at 100%. I like this kind of problems because you are not quite sure where the problem is; do I have to do coordinate translation? Get new coordinates of figures taking scaling in consideation? Who knows? Luckily the solution was pretty easy: override getFeedbackLayer() method in GraphicalNodeEditPolicy:

protected IFigure getFeedbackLayer() {
return getLayer(org.eclipse.gef.LayerConstants.SCALED_FEEDBACK_LAYER);

That is all, pretty easy-peasy, no?

Friday, April 17, 2009

Eclipse CNF filters

Recently I needed to apply a filter to a third party view. I could not easily work with given view because I did not have source code available and had to rely on reflection to add needed filters. At first I implemented org.eclipse.ui.startup to find the view and apply the filter - however this did not work as I wanted. Luckily the view relied on CNF and I was able to use org.eclipse.ui.navigator.navigatorContent to insert my filter without any need for reflection or searching view of interest.

Tuesday, April 14, 2009

Dropbox failed to connect in Ubuntu 9.04

I upgraded to Ubuntu 9.04 yesterday - everything went smooth except Dropbox was not connecting. I've become some attached to Dropbox that I don't use my flash driver anymore. Clearly I was upset, but thanks to Google and this post, I got everything working again and can happily shift files between computers with ease. Ahh, life is good.

Blogger Syntax Highliter