My blog has moved!

You should be automatically redirected in 6 seconds. If not, visit
http://kavachai.com
and update your bookmarks.

Tuesday, February 24, 2009

"services.exe" virus

Today when going to the web site of Nissan dealer present in my city I've got a virus. What it does is sending e-mails from my machine. Pretty unexpected situation.
Unfortunaly my antivirus did not stop it, but I found solution in a couple of minutes:
  • With the help of Task Manager I found additional services.exe running on the machine. The file was located at "C:\Windows\services.exe".
  • Since Windows thinks that this virus is a system component it does not allow to stop it. I used CopyLock application to remove it at the next system start.
  • Finally I removed this services.exe from the system startup list.
My system is healthy again!

Thursday, February 12, 2009

MVC vs MVP

Recently during my recearch on the different between MVC and MVP patterns I found two great articles.
Hear are two quotes from them.

1. Everything You Wanted To Know About MVC and MVP But Were Afraid To Ask

The two patterns are similar in that they both are concerned with separating concerns and they both contain Models and Views. Many consider the MVP pattern to simply be a variant of the MVC pattern. The key difference is suggested by the problem that the MVP pattern sought to solve with the MVP pattern. Who handles the user input?
With MVC, it’s always the controller’s responsibility to handle mouse and keyboard events. With MVP, GUI components themselves initially handle the user’s input, but delegate to the interpretation of that input to the presenter.

2. MVC or MVP Pattern – Whats the difference?

Here are the key differences between the patterns:

* MVP Pattern
o View is more loosely coupled to the model. The presenter is responsible for binding the model to the view.
o Easier to unit test because interaction with the view is through an interface
o Usually view to presenter map one to one. Complex views may have multi presenters.
*MVC Pattern
o Controller are based on behaviors and can be shared across views
o Can be responsible for determining which view to display (Front Controller Pattern)

Tuesday, February 3, 2009

Getting Ruby on Rails 2.2.2 working on Windows XP

When installing Rails 2.2.2 I ancountered a problem with sqlite3. Although sqlite3 is a default database used by Rails starting from version 2.2.2 on Windows XP is not such a trivial thing to make it work.

I started by trying to install sqlite3 using gem like this:
gem install sqlite3-ruby
But I got an error:
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake

Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'ruby.h'
Stop.
The solution is quite strange from my point of view:
  1. Download sqlite and sqlitedll from sqlite downloads (by now they are "sqlite-3_6_10.zip" and "sqlitedll-3_6_10.zip").

  2. Unzip both archives to Ruby bin folder ("C:\ruby\bin" on my machine). There should be three files: sqlite3.exe, sqlite3.dll and sqlite3.def.

  3. Install sqlite-ruby using such a command:
    gem install sqlite3-ruby --version 1.2.3
The strange thing is that if you do not use the version parameter installation will be unsuccessfull.