Power of grep

How to highlight results in ls output:

ls|grep -E --color "sh$|$"

This will highlight all files with *.sh extension in current directory.

Where -E means that we’re matching entries with regex,
|$ means that we don’t want to skip entries that do not match our regex (passing pipe further and closing it with dollar sign).

Apace CXF for REST application

I started to configure my first RESTful app using Apache CXF library and bumped into issue with JAX-RS binding. No matter how I tried to map my classes, I’ve still been getting this error in response instead of JSON data:

No message body writer has been found for response class ArrayList.

The solution was to add dependency on JSON mapping provider since Apache CXF does not include it. It can be XStream or Jackson, I used the last one.

Step 1.

Add dependency for org.codehaus.jackson:jackson-jaxrs to your project

Step 2.

Add JSON provider to Spring context configuration:

<beans xmlns="http://www.springframework.org/schema/beans"...>
    <jaxrs:server id="serviceId">
            <ref bean="myService"/>
            <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>


Vim game

To learn Vim with fun I started to search for some interactive guide with some practical step-by-step tasks.

I found a game that helps to remember the main Vim shortcuts:

git clone git://github.com/kikuchiyo/vim_game.git

Although I needed to spend some time to find out how to compile Ruby app with all dependencies.
Here is the recipe that worked for me:

First of all you need have installed MySQL server and Ruby itself:

sudo apt-get install mysql-server
sudo apt-get install ruby

Then install bundler (dependency tool for Ruby):

sudo apt-get install ruby-bundler

You’ll also need Qt 4 (couldn’t completely compile app with Qt 5 but I guess it should be installed as well):

sudo apt-get install qt4-default

Install dependencies:

sudo apt-get install libqt5webkit5-dev
sudo apt-get install qtquick1-5-dev qtlocation5-dev qtsensors5-dev qtdeclarative5-dev
sudo apt-get install libsqlite3-dev libmysql-ruby libmysqlclient-dev

Then try to set up the application itself:

bundle install
bundle exec rake db:drop db:create db:schema:load db:migrate
bundle exec rails s


Xubuntu-desktop (XFCE) recipes

How to move from Ubuntu 13.04 to Xubuntu (Xfce)?

Good steb-by-step manual: https://sites.google.com/site/easylinuxtipsproject/alternative

How to create keyboard layout shortcut?

setxkbmap  -option grp:caps_toggle,grp_led:scroll "us,ru"

How to make desktop icons text transparent (icons shadow analog on Windows)?

Run vi ~/.gtkrc-2.0 and add the following config there:

style "xfdesktop-icon-view" {
  ## opacity of text background (0 - 255, 0 = transparent)
  XfdesktopIconView::label-alpha = 0
  XfdesktopIconView::selected-label-alpha = 100

  ## text background colors
  base[NORMAL]    = "#EDECEB"
  base[ACTIVE]    = shade (0.8, "#86ABD9")
  base[SELECTED]  = "#86ABD9"

  ## text foreground colors
  fg[NORMAL]      = shade (0.9, "#FFFFFF")
  fg[ACTIVE]      = shade (0.8, "#FFFFFF")
  fg[SELECTED]    = "#FFFFFF"

  ## whether or not unselected icon text gets truncated (...)
  # XfdesktopIconVIew::ellipsize-icon-labels = 1

  ## text shadow to be painted with the icon labels
  # XfdesktopIconView::shadow-x-offset = 0
  # XfdesktopIconView::shadow-y-offset = 0
  # XfdesktopIconView::shadow-color = "#000000"
  # XfdesktopIconView::selected-shadow-x-offset = 0
  # XfdesktopIconView::selected-shadow-y-offset = 0
  # XfdesktopIconView::selected-shadow-color = "#ffffff"

  ## spacing and sizing of icons on the grid
  # XfdesktopIconVIew::cell-spacing = 6
  # XfdesktopIconView::cell-padding = 6
  # XfdesktopIconView::cell-text-width-proportion = 2.5
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view" 

GWT using Activities and Places

I’ve tried to simplify and categorize my vision of “Activities and Places” in real application since HelloWorld app from Google’s page doesn’t provide overview of the full-cycle development and shows us only 10% of the iceberg. Maybe this diagram will help someone either. Although in most cases the whole page can be one active area, example shows how to use two independent displays on the page (in this case Menu and Content). It can be useful, for example if you have completely different page views for site-administrator and user.

Online tools for quick prototyping

All tools mentioned in this post are free at the time it’s been written

  1. wireframe.cc – very simple and nice tool for web-pages prototyping.
    Idea: Select an area and choose which type of the object it will be.
  2. moqups.com – tool with a little more sophisticated interface and therefore has more functionality.
    Idea: Make a composition from many proposed samples (eg. switchers, diagrams, buttons, combos, radio buttons, keyboards) or create your own using simple shapes
  3. cacoo.com – has a bunch stencils for creation of a different type diagrams, UIs and schemes
  4. lumzy.com – has a lot of common with Cacoo but has more kind of elements for interface prototyping. However Lumzy is clumzy, you need to be familiar with it to quickly find something you need. Catalog of the components has pure design and organization.
  5. iphonemockup.lkmc.ch – this one doesn’t fit current topic as it’s designed for iPhones’ UI wireframing only but I really like it. It’s so simple and of course pencil style is fantastic. Too bad I didn’t find something like that for multi-platform interfaces.

GWT Designer for Eclipse Juno on Ubuntu 12.X

Today I’ve tried to install Google Eclipse Plugin to draw some forms for my GWT-based app and caught the exception:

GWT http-server started at
# A fatal error has been detected by the Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0x00007fb2229d45a0, pid=8150, tid=140404439688960
# JRE version: 6.0_37-b06
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.12-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libwebkitgtk-1.0.so.0+0x14245a0]  void WTF::freeOwnedGPtr<_GdkEvent>(_GdkEvent*)+0x15df0
# An error report file with more information is saved as:
# /home/ipcreeper/hs_err_pid8150.log
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

Searching for at least an hour I’ve finally found the solution:


Step 1:

Download and install libhunspell package (xulrunner has a dependency on it):


sudo dpkg -i libhunspell-1.2-0_1.2.14-4_amd64.deb

Step 2:

Download and install xulrunner package:


sudo dpkg -i xulrunner-1.9.2_1.9.2.28+build1+nobinonly-0ubuntu0.11.04.1_amd64.deb

Be aware that both libhunspell and xulrunner should be either i386 or amd64 version.

Step 3:

Open eclipse.ini and add path to installed xulrunner:

Step 4:

If editor still not running, try to set the environment variable GDK_NATIVE_WINDOWS to false before starting Eclipse. Do it with following command: