Posts

Technical Team Lead Interview Questions

Following are some of the questions which can be asked for a technical team lead interview: a. if you have a non performing developer in your team, how will you deal with them (Question relates to Motivation)? b. Have you ever had a project, that you were working on was in danger of missing the deadline and were you able to bring it back to schedule? if so how? c. Have you ever been part of recruiting members of the team? d. What document will you give to your developer when developing a requirement. State the details that will be included the document. e. What are your strengths and weaknesses? f. if we ask your team, what will your colleagues describe as your strengths and weaknesses.

Unable to add data connection.Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0,

Few days ago, I installed SQL Server 2005 on my Laptop. I opened up Visual Studio 2008 and tried to connect to SQL Server database. But, I got an error message: Unable to add data connection. Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. The solution for the above problem was to : Install the following from Microsoft SQL Server 2008 Feature Pack RC0, June 2008 - Microsoft SQL Server 2008 Native Client - Microsoft SQL Server System CLR Types - Microsoft SQL Server 2008 Management Objects if you do not have SQL 2008 then these features can be downloaded from: http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en#filelist After installing the components, close and reopen Visual Studio 2008, you should now be able to Add the database through your Server Explore...

Developer/Programmer interview practical test and solution

Below is a simple practical test which may be asked in interviews and the candidate may be expected to solve the problem within a duration of 40 to 45 mins . I have described the problem and given the solution for it. Question: A list of users and the manager they report to are available in the database. You need to display a). Count of all users who have a manager. b). Count of all users who do not have a manager. c). Display list of users and the managers they report to. Answer: When solving the problem , keep in mind the following: a. Design solution with clean architecture. - Properly layer your solution. Use separate project for data layer, business layer and presentation layer. Have a single solution file which combines all three project files. b. The test is for you to exhibit your problem solving/coding skills. Hence, avoid writing code which binds UI controls (ex: Dropdown,Repeater control) to DataSource controls(SQL, Xml or Object) . This will provide the required result, b...

AutoComplete using AutoCompleteExtender, JQuery and C# Web service

I implemented autocomplete functionality on one of my client website. Requirement: if user types in a location name incorrectly then the site is supposed to show a page which holds suggested names in radio button. The user selects one of the location and then clicks search, which will show a Search result page with properties relating to the location. The solution I offered was to use an auto suggest functionality which shows a list of suggested locations as and when the user types in the location textbox. This was agreed quickly since the time quoted was far less than the suggested requirement implementation and the UI would look 'very cool'... The solutions uses - AutoComplete Extender control (which is part of the Ajax Control Tool kit v3.5). - JQuery - perform ajax query to retrieve data. - Webservices written in C# to query the db and return results as JSON objects. I will publish the code sample.

NAnt development tips

Here are some Tips which might help you when debugging NAnt scripts. 1. Remember to update NAnt Framework tag if you are working with new version of .Net framework in Nant.exe.config file. I upgraded our system to .Net 3.5 and started coding. But when I checked in the files the nant build broke. I was racking my head for a while before I figured out that Nant was building for framework 2.0 and hence the new features which I coded against did not compile. 2. if you create new targets remember to add it in the 'depends' attribute of the 'build' target. I included a new component in my NAnt build script. I included the target for getting the latest file from sourcesafe and another target for building the file. When I ran the build script, it did not call the new targets. I figured out that I had not updated the 'depends' attribute of the build target task. Ex: 3. I use 'NantBuilder' tool which helped me in running specific targets and debugging it.

Navigate to another URL by pressing enter key

Problem : When I press enter , I want to navigate to another web page. I do not want to use form onsubmit event, as I am having the form tag on the master page. Solution: I have a form which has a search text box. The user enters the search keywords and presses enter. Below is the code (HTML rendering in this blog is awful, sorry about the illegible code) which does that Search A much more simpler implementation can be done using JQuery.

SQL Injection

Things to consider to avoid SQL Injection: 1. Have a function which vets the inputs from your forms :  ex: "select", "drop", ";" , "--", "insert", "delete", "xp_"  2. Escape single quotes with two single quotes ex: d'souza should be d''souza. 3. Set  size for number of characters text box can accept. Thus limiting the amount of untoward values that can be input 4. Do not use sa account for application related queries. Create a separate account with limited privleges. ex: if you need user to only view reports, create user account which has only 'SELECT' permissions.

Generics - List collection

// Generics example.  // Build a collection which accepts only a specific class type.  // ex: collection below accepts only cPerson namespace LearnOOp {    public class cGenericPersoncol     {         public string BuildGenericPersons()          {             cPerson cPer = new cPerson();             cPer.Name = "J Push";    //Create a List collection of type cPerson             List cPerColl = new List ();             cPerColl.Add(cPer); //// uncomment this line to test the collection. this should throw an error if you try passing //// a cMachine type class to the List collection created earlier.             //cMachine cMac = new cMachine();             //cMac.MachineName = "Matsumito";             //cPerColl.Add(cMac);             return cPerColl[0].Name;         }     }    // Person class     public class cPerson     {         string myName;         public string Name {             get { return myName; }             set { myName = value; }         } // Machi...

Search objects used in database

Below is the stored procedure which will query the database and find the list of objects which match the search string specified. CREATE PROCEDURE [dbo].[sp_Search_sProcs] @searchText varchar(100) AS SELECT sysobjects.name FROM sysobjects, syscomments WHERE syscomments.id = sysobjects.id and sysobjects.xtype = 'P' AND sysobjects.category = 0 AND syscomments.text LIKE '%' + @searchText +'%' ORDER BY sysobjects.name GO

Visual Studio debugger extremely slow

I was struggling with this problem for nearly a day and a half, before I found the solution. Hence, thought I will blog this. The website I was developing was running extremely slow when run under debugger of visual studio. Initially I thought, it may be the slowness of webservices or the database components that we were using. But passing the value through the interfaces produced results quickly. hence I concluded that the problem was with my local website code. The fix was elusive and time was running out. I began deleting the files in bin directory and recompiled the code. still same effect. I deleted the project .suo file and eureka! the project started running correctly!!! I read some where that deleting .ncb file may help aswell.. Happy Debugging : )

Dynamically setting classnames from style sheet

I was trying to find a way to dynamically set class name from stylesheet using javascript. many of the sites adviced to use obj.style.className==' ', but this did not work! instead use this : obj.className==' ' -- this work is IE and Firefox.

Calling a asp.net object from asp, returns Invalid procedure call or argument

I had to pass an object from asp to asp.net component but every time it returned an 'Invalid procedure call or argument:object name' I found that when passing objects from asp to .net components use the below method : oObject.Save(oObjectToBeSaved, errMsg) -- returned error message oObject.Save((oObjectToBeSaved), errMsg) -- works successfully. Also, the .net componenet which accepts parameters should have its signature set as ByRef..

Output content as excel and display File download box

Scenario: if you want to output some data as excel file, and display the File download dialog box, use the code below : Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition", "attachment;filename= .xls"

How to change the default crusor type of recordset when executing a stored procedure?

Set the parameters in the following order: rs.CursorType =adOpenKeyset rs.CursorLocation=adUseClient rs.open , Opening a recordset in this manner will change the default connection from ForwardOnly to Keyset.

Difference in month does not actually display last day of the month

When we want display a difference in months, datediff or date add does not help you in returning the last days of months, eg. if we do a dateadd(m,-3,'30 june 2005') will display '30 september 2005' but if you expected to get 1st of april 2005 then you got a problem, the below function gives a work around for the problem. DECLARE @Dt DATETIME SET @Dt = '30 June 2004' SET @Dt = DATEADD(m,-2,@Dt) SET @Dt = DATEADD(d,-DATEPART(d,@dt)+1,@Dt) SELECT @DT

Netscape 7.0 : Dynamically built controls loses value when their html is appended with a new html string!!

Here is what I found today : My requirement was to dynamically add text boxes in the form based on selection made from a drop down box. Then the user gets to type in information on the text box and save it. I planned to use div tag , and create input boxes dynamically into the div tag. This worked great : Here is what I did : I built a html string (sInsertHTML) with the code to create input box . This I appended to the divTag's innerHTML property. divTag.innerHTML = divTag.innerHTML + sInsertHTML This produced the desired result. i.e. I was able to create controls based on the selection from the drop down, recursively. PROBLEM While the above condition worked great it lost any values previously input in those boxes!!! To walk you through on what I did : I used the drop down to select a value and clicked the insert button. The code to write input control inside the div tag creates the control. I type some value in the newly created textbox. I then use the selection drop...

table permissions, dynamic sql

An important point to remember when writing dynamic SQL is to ensure that the tables that you are using in your SQL statement should have 'select' permissions enabled for the query to work. if you can't allow select permissions on the table then avoid using dynamic SQL (this may be the case in most of the production environments). I had the unfortunate experience of using dynamic SQL in a project without realizing the above issue. Everything worked in my system and in the test environment as well, but when the solution was deployed to production, the query did not work. I found that, the users in the production environment had permissions to execute stored procedures alone, and for the dynamic sql to work ( which used EXEC ' ) required select permissions on the table. hence the stored procedure failed. I re-wrote the query using COALESCE statement to workout the where clause. The link below touches on how to build dynamic where clause. http://www.sqlteam.com/i...