Saturday, December 24, 2011

The most common commands used in Vim

Movement commands
hmove left
jmove down
kmove up
lmove right
ctrl + bpage up
ctrl + fpage down
$move to end of the line
0move to beginning of the line
^move to the first non-blank character of the line
Gjump to end of the file
ggjump to beginning of the file
10Ggot to line
wmove foward to the word
bmove backward to the beginnig of a word
}jump foward one paragraph
{jump backward one paragraph

Editing commands
dddelete line
yycopy line
~upper or lower case
istart insert mode at cursor
Iinsert at the beginnig of the line
aappend after cursor
Aappend the end of the line
eaappend the end of the word

Search commands
/textsearch forward in the document for text
nmove foward to the search result
Nmove backward to the search result

File editing commands
wwrite to file
eopen file
pwdshow current directory
cdswitch Vim to directory
:browse eopen dialog
:q!close and drop changes
Folding commands
zRopen all
zMclose all
Other commands
:set listdisplay whitespaces
:set nolistdisplays normaly
:copenopens error window
:cclosecloses error window
:set expandtabto insert space characters whenever the tab key is pressed
:retabto change all the existing tab characters to match the current tab settings
:TlistToggleopens the taglist window

Tuesday, October 11, 2011


Scrum is an agile approach to software development. Scrum doesn't provides complete, detailed descriptions of how everything is to be done on the project, much is left up to the software development team. This is done because the team will know best how to solve the problem they are presented. 

Scrum relies on a self-organizing, cross-functional team. The scrum team is self-organizing in that there is no overall team leader who decides which person will do which task or how a problem will be solved. Those are issues that are decided by the team as a whole. The team is cross-functional so that everyone necessary to take a feature from idea to implementation is involved.

These agile development teams are supported by two specific individuals: a scrum master and a product owner.

Scrum projects make progress in a series of sprints, which are timeboxed iterations no more than a month long.

To read more about Scrum visit this site.

Snippets in Vim

A snippet is a piece of often-typed text that you can insert into your document using a trigger word followed by a <Tab>. To have this functionality in my Vim I use snipMate plugin.

 For a quick introduction, see this screencast:

Monday, October 10, 2011

Friday, October 7, 2011

Vim file navigation

To navigate through directories and to open files I use NERDTree plugin. The plugin opens small buffer on the left which contains the file system tree.

If you want to pull up NERDTree so it's always visible docked to the left of your Vim window you can type:

Also NERDTree allows to modify the file system tree. Hit key 'm' and it will open menu with some option.

To refresh the file system tree simple hit key 'r'.

Friday, September 30, 2011

Recursive removal

Remove all files and directories (recursive removal):
rm -rf /tmp/foo
Remove all files from current directory use this command:
rm -f *

Vim configuration

To use vim, you should install vim package:
sudo apt-get install vim

If you prefer to use GUI based vim, you should install vim-gnome package:
sudo apt-get install vim-gnome

vim is a highly configurable editor. A list of files and their locations are given below.

  • ~/.vimrc is the vim configuration file which vim reads on startup
  • ~/.gvimrc is the gvim configuration file which gvim reads on startup. It's best to keep only gui specific settings here, as it will take preference over the settings in your .vimrc file.
  • ~/.vim/ is the directory in which the user can add utility plugins, syntax highlighting plugins, and indent plugins.

Monday, August 15, 2011


I prefer to use HSV color space instead of RGB because they better match how people perceive color. The HSV color space consist of three components: hue, saturation and value.

  • Hue: The basic color in the color wheel, ranging from 0 to 360 degrees where both 0 and 360 degrees are red.
  • Saturation: How pure (vs. dull) the color is, ranging from 0 to 100, where 100 is fully saturated and 0 is gray.
  • Value: How bright the color is, ranging from 0 to 100, where 100 is as bright as possible and 0 is as dark as possible (black).
An example where color's value reduced by 20 (100, 80, 60):

See also this article in msdn to get more details.

Sunday, May 29, 2011


Vim is a highly configurable text editor built to enable efficient text editing. Vim you can find here.


Read his book in Swaroopch website, it will help you to learn how to use the Vim.

See also this post in Kevin Berridge's blog to get more details how to use Vim in .NET development.

Wednesday, May 25, 2011

Observer Synchronization

In some applications you have multiple screens available that display presentations of a common area of data. If a change is made to the data through one of these screens, you want all the other screens to update correctly. However you don't want each screen to know about the others, because that would increase the complexity of the screens and make it harder to add new ones.

See also this post in Martin Fowler's website to get more details. Observer pattern is described here.

Saturday, May 21, 2011

Audit Log

A simple log of changes, intended to be easily written and non-intrusive.

See also this post in Martin Fowler's website to get more details.

Thursday, May 19, 2011


Fiddler is an HTTP Proxy running on your local PC. You can download it from here.

If you want to catch WCF messages with fiddler, then replace 'localhost' to 'ipv4.fiddler'.

Tuesday, May 17, 2011

Tuesday, May 10, 2011

Google Chrome Frame

Google made a plugin for IE which allows to use google chrome in IE. You can install this within IE without needing admin access. You can read more here.

To get chrome frame visit google code site.

Sunday, May 1, 2011

How to remove unused packages

To remove all unused packages use this command:

sudo apt-get autoremove

Saturday, March 26, 2011

Wednesday, March 23, 2011

chmod command

To change permissions on a UNIX file or directory, use the chmod command.

chmod category+permissions filename

Gives read, write and execute permission:

chmod +r file
chmod +w file
chmod +x file

Saturday, March 12, 2011

Google styleguide

Google defined style guides how to write code. It covers C++, JavaScript, Python, Object-C languages and XML.

You can read more on google-styleguide website.

Wednesday, March 9, 2011

Essential database naming conventions

There are a few simple rules that i use for naming database objects (including the name of the database itself).

  • User lowercase characters. Eliminates question of proper case as well as errors related to case-sensitivity and speeds typing rate and accuracy.
  • Separate words and prefixes with underlines, never use spaces. Promotes readability and offers greater platform independence. Avoid having to bracket names (e.g. [book name] or "book name").
  • Do not use dashes in database names.
  • Avoid using numbers.

Database name

[system name]_[customer or purpose]

Table name

[schema].[table name]
  • Give tables singular names, never plural.
  • Use schema - it allows to group database tables.

Field name

[field name]
  • The primary key should be the singular form of the table name suffixed with '_id'.

Primary key name

pk_[table name]
  • Always use the 'pk_' prefix for primary key name.

Index name

ix_[table name]_[index field names]

  • Always use the 'ix_' prefix for index name.

Foreign key name

fk_[table name]_[foreign key field names]

  • Always use the 'fk_' prefix for index name.

Database example

I added a simple database diagram which has three tables: 'person', 'organisation' and 'account' and it has two namespaces: 'demographic' and 'identification'. Person has relationship with organisation.

Saturday, January 22, 2011

How to ignore files in Git

If you have files which you don't want to commit to repository, you can add entries to .gitignore file and these files won't be tracked any more.

You can add entry to .gitignore file with echo command:

echo csharp/Presentation/Presentation.suo >> .gitignore

If .gitignore file is not presented in your root directory of the project, you must create it.

The .gitignore file should be in your repository, so that changes to it can be merged and so on.

Tuesday, January 18, 2011

Do not use regions

"A violation of this rule occurs whenever a region is placed anywhere within the code. In many editors, including Visual Studio, the region will appear collapsed by default, hiding the code within the region. It is generally a bad practice to hide code, as this can lead to bad decisions as the code is maintained over time." - one of readability rules of style cope.

If you have regions in your code, you can solve this problem in Visual Studio 2010 by expanding all regions by default.

Got to 'Tools->Option->Text Editor->C#->Advanced' and 'Enter outlining mode when files open' must be unchecked.

Saturday, January 15, 2011

Passive view

Passive view is an approach of the Model-View-Presenter (MVP) pattern. In Passive View the view is devised as thin and passive as possible.

In a Passive View approach, the view is a raw sequence of UI elements with no additional data binding or formatting. The presenter acts directly on the UI elements and works simply by loading data into them.

  • You have an inherently more testable system because the logic in the view is reduced to an absolute minimum.
  • You run no risk at all by not testing the view.
  • The Passive View is very explicit mechanism. This makes is much easer to read the code see what is happening - particularly useful if you're trying to debug when things go wrong.
  • It easy to support multiple GUIs. The presenter ignores any UI technology behind the view.
  • A really passive view can be quite cumbersome to write  and maintain and can add a lot of complexity to the presenter. 

See also this post in Martin Fowler's website to get more details.

The core of the MVP is interaction between the view and the presenter, why I don't declared any interface or class for the model.

Here is my implementation of Passive View:

using System;

namespace NOrca
 public interface IView : IDisposable
  IPresenter Presenter { get; set; }
  event EventHandler<ActionEventArgs> Action;
  void RaiseAction(object sender, string actionName, params object[] arguments); 

using System;

namespace NOrca
 public interface IPresenter : IDisposable
  IView View { get; set; }
  void Initialize();

Saturday, January 8, 2011

Access windows-host shared folders from ubuntu-guest

Mount the shared folder like this:

sudo mount -t vboxsf folder-name /media/windows-shared

See also this post.

Model View Presenter (MVP)

Model View Presenter (MVP) is a user interface design pattern. It's dedicated to isolate domain logic from the user interface and permits independent development, testing and maintenance of each.

A scenario in which you need to support multiple GUIs MVP is the best choice. It allows to write a presenter and reuse it in Windows and ASP.NET.

MVP is not a pattern that can be implemented quickly, because it can be a bit expensive to implement in relatively simple applications. On the other hand, it shines in enterprise applications, where you really need to reuse as much presentation logic as possible, across multiple platforms.

MVP is based on three actors: the view, the model and the presenter.

Model is a business layer with domain model, a table module or any sort of object model that suits you.

View is an interface that displays data and routes user actions to the presenter.

Presenter is a class which receives input from the view and passes commands down to model. When it gets results from the model it updates the view through the contracted view interface. Also presenter responsible for jumping to the new user interface.

MVP can be separated into Supervising Controller and Passive view.