Posts

Error when Installing SQL Server 2008 R2 Management Studio

Yesterday, I downloaded and tried installing the 64bit version of the Sql Express Mangement Studio, but I received the below error message   Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installations to SP1 level, by visiting Microsoft Update This message was particularly baffling since my laptop was a new build and I had installed VS 2010 only. On further investigation I found that one of the software installation that I did had installed VS 2008 components. The Add Remove programs in Control panel wasn't helpful. I used the VS2008 uninstall tool from microsoft site http://go.microsoft.com/fwlink/?LinkId=105801 This removed the VS2008 instance completely. I reran the setup for Management Studio and all worked well. To do it manually try http://blogs.msdn.com/b/joy/archive/2008/10/21/how-to-remove-visual-studio-2008-manually.aspx Hope it works out for you..

How to get Ajax webmethods to work on Sitecore

Recently I created webmethods on my aspx page and called them using jquery ajax. But they returned a 401 error message. after further investigation using Fiddler I realized that Site core intercepting the ajax calls and throwing error messages. Once I found this, the idea was to stop sitecore from intercepting the ajax request. To do this, I tracked the setting node called "IgnoreUrlPrefixes" in web.config and added the webpage name which contained the webmethods. The IgnoreUrlPrefixes node tells sitecore to ignore the urls (separated by pipe). So my web.config read as <setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd| pagewhichcontainswebmethod.aspx </setting>  Happy coding

Drupal site deployment - deploy drupal 6 site from localhost to a hosting server

Deploying a drupal site to live is an easy process. But if you are doing this for the first time, like I recently did, it can be a frustrating experience. I deployed a drupal 6 site from my localhost to my hosting provider account. This was my first deployment in drupal and there were lots of stop and starts before I got the site working. I decided to record all the steps I followed to get the deployment working. Step-By-Step instruction on how to deploy a drupal site to live server STEP 1. PREPARE DATABASE Open your development drupal site and empty the cache(Administer>Site Configuration>Performance and click the 'Clear Cache Data' button). It is important to do this, it will cause you headache later on live if you leave it. Login to your Phpmyadmin (http://localhost/phpmyadmin) Select the development database (you can find the database name and credentials used by your drupal site on /sites/default/settings.php file) and click 'Export'. Make sure you select...

How to change .NET framework version without restarting IIS

When we want to change the .NET Framework version for an existing site, IIS will display a warning message saying it will restart the W3SVC service. We may not want to do this, as it will stop other websites running in IIS. Below is Step By Step instruction to change the .NET framework version without restarting the W3SVC service. Step 1 : In IIS navigate to the website (which requires change in .net framework version) Step 2 : Right click on the site and select All Tasks> Save Configuration to a File and save the configuration to a file. Step 3 : Open the configuration file and look for the IISWebServer tag which contains the siteid. Below is a sample line in the configuration file: IISWebServer Location ="/LM/W3SVC/1890249283" the number 1890249281 is the site id. Step 4 : Navigate to C:\windows\microsoft.net\Framework\<new framework version>\ for example if you want to switch the site to .NET Framework 4.0 then navigate to the 4.0 framework folder f...

ubuntu copy command throws cp: omitting directory

I wanted to backup some directories before making some changes, and came across an error cp:omitting directory This is because I did not include a recursive argument in my copy command. So the solution is to include a -R (for ubuntu and CentOS) command in copy command like : cp -R websites/myshinywebsite .

Drupal - How to display webform node in a block?

While building a site in Drupal 6.x, I had a requirement to display a contact us form box in all the pages of the site - except, on the Main Contact Us Form page(ofcourse, you wouldnt want and extra contact us box sticking!). I started by creating a new content type using the WebForm module. I added fields like firstname, lastname, emailaddress, company url and message and saved it. After this, I tried to figure out a way to add the form to a block. The idea was to stick the form in a block and place it on a content region and configure it to show on all pages except admin pages. But, I was stuck on how to display the webform node in a block. One idea was to use the NodeToBlock module. I had a feeling that there could be an easier way to implement this and went back to the webform page and dug up all the options in the webform form and hey presto! buried at the bottom of the settings was a check box 'Available as block'. I checked this and a block was created for this f...

Drupal - Access denied. You are not authorized to access this page.

LEVEL : BEGINNER I recently read a post about 5 Top Drupal techniques and tried it on my site. I hid the login form from all users. To try the changes I made, I logged out from my drupal site. Disaster! I couldn't log back in and I was the super user! No matter which page I tried accessing, it threw the Access denied page. I tried the following: 1. Typed following urls to see if I can get the login form: http://localhost/drupal/ http://localhost/drupal/admin/ http://localhost/drupal/admin/login/ 2. Repaired Session table Steps followed: using phpmyadmin (http://localhost/phpmyadmin/) - navigate to drupal database and view the tables. select 'Session' table and scroll right down the page and select the dropdown which has 'With selected' option preselected. Select the 'Repair' option. This will rebuild your session table. 3. Cleared Session table. The above 3 did not work. Finally found the correct login page. http://localhost/...

Emerging technologies drummed up for 2010

Image
Gartner released report on Hype cycle for Emerging Technologies 2010. A mine-field of technologies for enterpreneurs who want to build their so called solutions (hardware and software) while people are still excited about it! I am betting on Cloud Computing/Web platforms along with Social Analytics to hit the plateau of productivity.

Windows 7 and GoToMyPC - Configure the Domain Group Policy to allow GoToMyPC to send Ctrl-Alt-Del

After installing Windows 7, I was unable to logon to the office computer using GoToMyPC. It came up with an error message along the lines of ‘The Domain Group Policy for this computer does not allow GoToMyPC to send Ctrl +Alt +Del. please contact your administrator'. I tried following the instructions given in the documentation of GotoMyPC's 'Pro Administrator Guide' till point 7, which read, I quote "Locate the Group Policy Object (GPO) in the domain or sub-domain that contains the policy that is preventing GoToMyPC from sending Ctrl-Alt-Del.". I spent some time looking for this policy but couldn't. I then started digging further into this issue and came across the concept of 'Secure Attention Sequence' which is basically a special sequence of events that enables a user to log on or off a computer, and how Windows Vista/Windows 7 introduced a new group policy setting which controls whether or not software can simulate a SAS. I solved my pr...

How to validate default values in a form ,- jquery validation plugin

I had a form which contained default values in the text boxes. ex: The first Name box has value 'Your Name' in it. But when onfocus, the text was cleared for user input. As I was using Jquery validation plugin i wanted to handle this scenario using jquery. Below is my question and the answer i came up with. http://stackoverflow.com/questions/2733922/jquery-validation-how-to-ignore-default-values-when-validating-mandatory-fields

jquery validation plugin and IE8 - 'jQuery.event.special.focusin' is null or not an object

I recently was using jquery validation plugin for form validation. It worked perfect on Firefox and Chrome. But when I tested on IE 8 , it did not work. The form submitted without any validation. using the inbuilt Javascript debugger for IE 8 (press F12 to activate it), I noticed the error 'jQuery.event.special.focusin' is null or not an object. I ran the sample that came with the jquery.validation plugin and it seemed to work on IE8 without any issues, the only thing I noticed was that the reference for jquery.js and the jquery.validation plugin were right below each other. So I did the same, I moved the jquery.js reference from master page to the page where the validation plugin was used and the validation worked fine! <script type="text/javascript" src="assets/scripts/jquery-1.2.6.min.js"></script> <script src="assets/scripts/jquery.validate.min.js" type="text/javascript"></script>

window.location does not work on Firefox

I had a scenario wherein a user clicks a button and a client side javascript function executes and redirects user to another page. I used window.location.href for redirection, but this did not work in firefox. Having looked up at other sites, the suggestion was to use window.location but this did not work still. I then realised that the problem was the way the javascript function was called in the onclick event of the button and it required a return false; to get it working. Below is the code sample, the button has a return false, which prevents the form from submitting to itself and enable re-direction. <script language="javascript" type="text/javascript"> function GoToRegistration() { var url = "http://www.lotussoftwaremall.com/" window.location=url; } </script> <input name="submit" type="image" src="submitbutton.png" onclick="GoToRegistration(); return false ;" width="80" he...

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...