Thursday, July 12, 2012

Interviews and common questions

Below you will find few most common interview questions

Difference between interface and abstract class

  • Class can inherit from multiple interfaces but only one abstract class.
  • Interface cannot provide any code only the signatures.
  • Abstract class can contain access modifiers.
  • Interfaces cannot define fields.

Clustered vs Nonclustered Indexes

Nonclustered Indexes
Nonclustered indexes (also called “indexes”) are the normal indexes that are created on your tables. SQL Server supports 999 nonclustered indexes per table.
Each nonclustered index can contain upto 1023 included columns. Columns of the TEXT, NTEXT and IMAGE data types can not be included either.

Clustered Indexes
SQL Server only supports a single clustered index per each database table.
Clustered indexes do not support included columns. This is because clustered indexes contain all the columns which aren’t in the index as included columns already. There is no way to override this. Columns with the data type of TEXT, NTEXT and IMAGE are not included within the clustered index. As with the normal table these values are stored out of bounds and only the pointer to the physical location on disk is stored within the index.

More here

Common design patterns

Singleton
The Singleton pattern is a pattern that makes sure that a class only has a single instance, and provides a global access point to it. A class that implements this pattern is itself responsible for keeping track of it's only instance rather than relying on global variables. Many times this pattern is used to hold a part of a system where there can only be a single one. The file system of Windows is a piece like this.

Factory Pattern
This strategy for creating new object instances is known as a Factory pattern. Rather than invoking the object's constructor, you can ask the object factory to create the instance for you. That way, the factory class can hide the complexity of object creation (like how to parse a Double out of a string). If you wanted to change the details of creating the object, you'd only have to change the factory itself; you would not have to change every single place in the code where the constructor is called.

More here

Thursday, May 24, 2012

TechNode - Secure your IIS 7.5

OK, everybody knows that some parts of every website (or almost every website) should be secured by SSL,
but some people are not aware of SSL internals as such. I'll try to write some quick tips how to harden our SSL.

First of all check your SSL secured website using this online tool. Default IIS installation with regular SSL certificate (I use StartSSL) should score around 83-85. Now we can try to add few tweaks.

1. Enable TLS 1.1 and/or TLS 1.2 on your Windows 7/ Windows Server 2008 R2 bu applying this patch - link.

2. Open command line, type gpedit.msc and go to Computer Configuration, Administrative Templates, Network, and then click SSL Configuration Setting. Under SSL Configuration Settings, double click the SSL Cipher Suite Order setting.The cipher suites TLS_RSA_WITH_RC4_128_SHA and TLS_RSA_WITH_RC4_128_MD5 must be put first on the line. You can use following list (remember to remove all new lines and white spaces):

TLS_RSA_WITH_RC4_128_SHA,
TLS_RSA_WITH_RC4_128_MD5,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P384,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P521,
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384,
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P521,
TLS_RSA_WITH_AES_128_CBC_SHA256,
TLS_RSA_WITH_AES_256_CBC_SHA256,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P384,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P521,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P384,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P521,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P521,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
TLS_RSA_WITH_AES_128_CBC_SHA,
TLS_RSA_WITH_AES_256_CBC_SHA,
TLS_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256

Enable your rule and restart your Windows server. After reboot re-run online validation.
The main goal is to get rid of issues related to BEAST vulnerability (read more here).

3. Optionally you can use Nartac's IIS Crypto tool (available for free).
It allows you to configure your IIS to be PCI and FIPS compliant.

After playing around you should be able to achieve around 93 points in online scan and get rid of BEAST attack vulnerability.

Enjoy :)

Tuesday, May 15, 2012

TechNode - Issues with iDrive backup

iDrive works great as a backup tool, but recently I found small issue which (as always) causes big problems.
After one of our servers crashes I was restoring content from backup. The issue was that iDrive doesn't create empty folders even that they exists in backup set - it was especially problematic for VisualSVN server because it was unable to create lock file. After recreating default folder structure everything starts working OK.
Possible solution - create a script which will store and recreate folder structure, at least for common folder schema.
TechNode - How to sync time on Windows 2008 R2 using script?

Create .bat (for examle time.bat) file with following content:

@echo off
w32tm /config /update /manualpeerlist:swisstime.ethz.ch 
/reliable:yes /syncfromflags:all


Setup Task Scheduler to run it every day at 00:00.

Thursday, May 10, 2012

Our Chicago node will be down for maintenance on Thursday, the 10th of May 2012 between 10:00AM and 11:30AM GMT.
This year is announced as the IPv4 exhaustion year so it seems very important to get familiar with IPv6 - next generation of IP protocol. It can be achieved by taking a course or certification like the on from Hurricane Electric. After few weeks and passing few tests (some of them require your own environment) you can get Sage level like I did :)
TechNode - How to use 32bit IBM Informix .NET driver on 64bit Microsoft Windows platform

1) Download 32bit version of IBM Informix Driver from IBM's website
2) Extract it
3) Create .bat file (for ex. install.bat) with following content:
@echo off
set PATH=%WINDIR%\SysWOW64;%PATH
installclientsdk.exe
4) Run the install.bat file
5) After installation completed type in command line:
c:\Windows\System32\SystemPropertiesAdvanced.exe

6) Click "Environment variables" button and set new variable "INFORMIXDIR" and point it to the right directory ("c:\Program Files (x86)\IBM\Informix\Client-SDK-x32\" on my setup)
7) You can now use reference to IBM.Data.Informix assembly which is located in "%INFORMIXDIR%\bin\netf20" directory and compile you project as 32bit.

Wednesday, May 9, 2012

Preparing the lunch of our first publicly available service. We hope that it will be something completely new (OK, maybe not completely) and will change a market a little bit. Probably next week we should post additional details.