My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit and update your bookmarks.

Saturday, 27 March 2010

Fixing the annoying XP Antivirus 2009 OR 2010

This is not a post directly related to my blog but i am sure there are few people out there that might be facing same issues. In the last one week i had friends whose windows machines have been infected the XP Antivirus 2010, which seems to be a clone of XP Antivirus 2009. The symptoms include that you are get annoyings popups asking you to pay for an antivirus, i hope you have exposed yourself already.

There are so many ways to fix this problems.

The first one is a biased solution, which is ditch your windows machine and buy a macOsx or format your machine and install ubuntu. Well i guess that wouldnt be a popular option.

So i have an alternative:

1. Install Malwarebytes, it is quite a good tool to remove malware from your machine.
You would notice that it would detect quite a number of malware, make sure after the full scan, you remove all the infections detected.

You are also gonna notice that, .exe files would not work after you have deleted the threats discovered by Malwarebytes.

2. To fix .exe files not working, follow the steps described below.

Have the following text copied into a notepad :-

------Start --------Do not copy this line, copy starting next line ----------------

Windows Registry Editor Version 5.00

"Content Type"="application/x-msdownload"






@="\"%1\" %*"


@="\"%1\" %*"






[HKEY_CLASSES_ROOT\exefile\shellex\PropertySheetHandlers\ShimLayer Property Page]

-----------End--------------Do not copy this line. Copy till the end of previous line------------

Boot the computer in safe mode with networking

- Usually by tapping F8 when the computer boots up

Open My Computer, Click on tools and then folder options.

Select - "Show hidden files and folders"
- Uncheck "Hide protected operating system files"

Apply and then OK

For XP :-

5. Navigate to C:\Documents and Settings\%userprofile%\Local Settings\Application Data
Look for either of the following files :-

- av.exe
- msascui.exe

And delete these files .... Hopefully these should have been removed by the malwarebytes.

Now open the notepad file saved on your desktop earlier

Click on file-> save as

- Select file type as all files
- Name the file as fix.reg
- Encoding should be Unicode
Run that file, it will edit the registry accordingly

Now restart the computer in normal mode and everything should working fine.

Wednesday, 10 March 2010

Blank cells in step tables in cucumber 0.3.11 is represented as nil

In my current job, I have been doing a lot of acceptance test using Cucumber, Watir and RSpec, obvious all in Ruby. I have been using Cucumber 0.6.x, in which blank cells in the step table are represented by empty string (""). This was okay for me until today when i had to use a previous version of Cucumber 0.3.11 due to reasons including compatibility with other projects in the CI build. And my tests start failing because blank cells are represented as nil.

There was fix put in the current release of cucumber to change blanks to be represented as empty and not as nil(for whatever reason, which i don't really care, as both nil and "" has got its own arguments.)

Some code to explain this, Assuming i have a step table as below:

Given that i have the following detail in my app
|Body1 |Body2 |Body3 | |

Notice that the last column of the second row is blank, this would be represented as nil in cucumber 0.3.11 while it is represented as empty string "" in cucumber 0.6.x

In my step definition file, I have fixed this by converting every nil value to empty ("")

Given /have the following detail/ do |table|
table.rows.each do |row|! {|value| convert_nil_to_empty_string(value)}
# do some other stuff with row as every nil object has been converted to empty string
# The map! method for Array, allow you to invoke the block for the array and it amends
# the existing array

The method which i call to convert nil to empty is below:

def convert_nil_to_empty_string(test_string)
if (test_string.nil?)
return ""
return test_string

There might have been a better way to do this but this surely worked for me in this scenario and the reason i decided to use a method was that the map! method would only allow me use the variable "value" only once in the block. I am sure there are some rubyist out there, that could advice me on some shorthand for this ....... Hope it helps you too