I have noticed few times that when a new column is added to SQL server database table, the column gets added from design view and I can write a select query for it. But in the select query, the column name gets highlighted and says the column name is not valid even when the select query works. An example is below.
January 13, 2014
January 11, 2014
Few days back, while I was at work, I found that my computer running slow. I quickly checked the task manager and found that I was running out of memory. That was a bit strange as I have 8GB of memory. Anyways, what I found is there were lot of processes running from Google Chrome that was killing it. Basically, each of the tab is a process and there is no way to add up the full memory usage in Task Manager. So, I did something silly and add up the memory from each of the processes in the calculator. But that's silly!
January 10, 2014
sSql Server has the option to store XML data. This is great as it means we can store xml data and also run sql scripts on it. Yes, we can run sql scripts to retrieve certain fields within the xml. Ti start with, let's use the Customer table that I created in previous post and add a new field Person that is of type xml.
January 8, 2014
So, how does html import work? Well, it does not work in most browsers. In fact, it only works in Chrome 31+ when "html imports" is turned on. It is important to note that it is a standard mentioned in W3C so the feature might become common in other browsers. So, how do I write the import code snippet. Here's how.
As you can see, it's similar to css import except the rel attribute value is now import. So, as a next step, I ran the page in the Chrome browser and it does not do anything. Oh, I need to turn on the html import feature first. To do so, I went to chrome://flags/#enable-html-imports and clicked on enabled and fingers crossed.
January 7, 2014
For this example, I will start with the web service. It's going to be asmx service that simply adds and subtracts numbers that it retrieves from the front end. Here's the code for the web service.
On the front end, I have couple of text fields, 1 option field to select to add or to subtract, a button that will trigger the script when clicked and a span element that will display the data. Here's the code for the html front end.
To start with I am calling jquery source file. Next, in the button click handler, I am forming the service url based on the selection. The important bit is this line
Note that a and b are parameter names in the service and I am sending the value of the text boxes. Finally, on success, I am populating the data in the span element. In case, error occurs, for example, if we type in "abc" in the text box or the web service is down, then the error function is fired and the text "Error!!!" is displayed within the span element.
Another thing to note is that the return value in json has .d at the end. This is within the success function as below.
The .d is a wrapper that ensures the payload is a json object.
January 6, 2014
A unique key is a field in a table that appears only once in the table and therefore can uniquely identify the table. It's similar to a primary key in the database but it differs in some ways including that it can accept null value. The null value can appear only once for the unique column in the table.
To add a unique key using sql server management studio, and click on indexes / keys option. The following popup will display.
From the popup options, select the columns that need to be unique, choose Is Unique to Yes and set the type as Unique Key. Click close and save the changes to the database.
January 5, 2014
January 4, 2014
I have worked on setting up windows servers and then IIS and sometimes I have noticed that IIS does not recognise asp.net straight way. If that happens, the error message - Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list - is displayed on the browser when the asp.net site is run. Html files will still work at this stage.
To workaround this issue, asp.net will need to be registered again. To do so, open command prompt and change the directory to point to .net framework. In 32 bit system it will be at %windir%\Microsoft.NET\Framework\v4.0.21006\ and in 64 bit system it will be at %windir%\Microsoft.NET\Framework64\v4.0.30319\ .
Run the command aspnet_regiis.exe -i .
This will register asp.net . The following screen shot will appear on command prompt.