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


    #include
    #include
    #include
    int main(void)
    {
    execl("/usr/local/bin/svn", "svn", "update",
    "${dirNameToUpdate}",
    (const char *) NULL);
    return(EXIT_FAILURE);
    }



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

    #!/bin/sh
    /svn/autoupdate/autoupdate


  • 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);
contextService.activateContext("com.iwaysoftware.explorer.refresh");
}


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"
name="Refresh">



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 127.0.0.1:3000 0.0.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. Dailymotion.com 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.

Blogger Syntax Highliter