Tuesday, September 15, 2009

Install RMagick on Ubuntu

  1. sudo aptitude install -y imagemagick  
  2. sudo aptitude install -y libmagick9-dev  
  3. 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:
  1. <extension point="org.eclipse.ui.contexts">  
  2.  <context description="allow refresh via f5" id="com.iwaysoftware.explorer.refresh" <br="">   name="refresh" parentId="org.eclipse.ui.contexts.window">  
  3.  </context>  
  4. </extension>  


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

  1. View.createPartControl(Composite parent) {  
  2. ...  
  3. ...  
  4.  IContextService contextService = (IContextService) getSite().getService(IContextService.class);  
  5.         contextService.activateContext("com.iwaysoftware.explorer.refresh");  
  6. }  


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.

  1. <extension point="org.eclipse.ui.commands">  
  2.   <command categoryid="org.eclipse.debug.ui.category.run" <br=""></command>   defaultHandler="com.iwaysoftware.explorer.handler.RefreshHandler" id="com.iwaysoftware.explorer.refreshCommand"  
  3.    name="Refresh">  
  4.     
  5.  </extension>  
  6.  <extension point="org.eclipse.ui.bindings">  
  7.   <key commandid="com.iwaysoftware.explorer.refreshCommand" <br="">   sequence="F5" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"  
  8.    contextId="com.iwaysoftware.explorer.refresh" />  
  9.  </key></extension>  
  10.  <extension point="org.eclipse.ui.contexts">  
  11.   <context description="allow refresh via F5" id="com.iwaysoftware.explorer.refresh" <br="">   name="refresh" parentId="org.eclipse.ui.contexts.window">  
  12.   </context>  
  13.  </extension>  

Saturday, September 12, 2009

Kill process that is using paricular port

Find process id and kill it
  1. ruby@t61:~/dev/ruby/demo$ sudo netstat -lpn | grep 3000  
  2. [sudo] password for ruby:  
  3. tcp        0      0 127.0.0.1:3000          0.0.0.0:*               LISTEN      5358/ruby       
  4. ruby@t61:~/dev/ruby/demo$ kill -9 5358  

Blogger Syntax Highliter