Thursday 25 July 2013


How many web.Config can be in web application?

In an application we can have no. of web config file but they must be in Different Directory . By default only one in an application.






count length of word without using inbuilt functions in c#


int myOwnGetStringLength(String str)
{
   
int count = 0;
   
foreach(Char c in str)
       count++;
   
return count;
}

other way

private int stringLength(string str) {
       
int length = 0;
       bool done =
false;
       
do {
           
try {
               
char c = str[length];
               length++;
           }
catch (IndexOutOfRangeException) {
               done =
true;
           }
       }
while(!done);
       
return length;
   }













A prime number is a natural number that has only one and itself as factors.
#include <stdio.h>
  • main() {
    • int n, i, c = 0;
    • printf("Enter any number n: ");
    • scanf("%d", &n);
    • /*logic*/
    • for (i = 1; i <= n; i++) {
    • if (n % i == 0) {
    • c++;
    • }
    • }
    • if (c == 2) {
    • printf("n is a Prime number");
    • }
    • else {
    • printf("n is not a Prime number");
    • }
return 0;}

HTTP Methods: GET vs. POST


Two commonly used methods for a request-response between a client and server are: GET and POST.
  • GET - Requests data from a specified resource
  • POST - Submits data to be processed to a specified resource

Some other notes on GET requests:
  • GET requests can be cached
  • GET requests remain in the browser history
  • GET requests can be bookmarked
  • GET requests should never be used when dealing with sensitive data
  • GET requests have length restrictions
  • GET requests should be used only to retrieve data
----------------------------------------------------------------------------------------------------------------------------

Some other notes on POST requests:
  • POST requests are never cached
  • POST requests do not remain in the browser history
  • POST requests cannot be bookmarked
  • POST requests have no restrictions on data length

gridview(web) and datagrid.(window)


What is the basic functions for master, msdb, model, tempdb databases?

The Master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care.
The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.
The tempdb holds temporary objects such as global and local temporary tables and stored procedures.
The model is essentially a template database used in the creation of any new user database created in the instance.

Why the Stored Procedure takes long time to run for first time?
The reason for the same is because Stored Procedures are compiled when it runs first time. When I answered the same, he replied that Stored Procedures are pre-compiled, and this should not be the case. In fact, Stored Procedures are not pre-compiled; they compile only during their first time execution.
There is a misconception that stored procedures are pre-compiled. They are not pre-compiled, but compiled only during the first run. For every subsequent runs, it is for sure pre-compiled.
If you create any SP, you will find that there is no cache entry for the execution of that SP.
After running the SP for the first time, the entry for the cache is made in the system.
If we see the following script, we can notice the different of cache when SP was created and SP was executed.

Garbage Collection in .NET


Garbage collection is a process of releasing the memory used by the objects, which are no longer referenced.
The Database Designer

The Database Designer is a visual tool that allows you to design and visualize a database to which you are connected. When designing a database, you can use Database Designer to create, edit, or delete tables, columns, keys, indexes, relationships, and constraints. To visualize a database, you can create one or more diagrams illustrating some or all of the tables, columns, keys, and relationships in it.

Difference betwen sql 2005 & 2008?

difference b/w ddl trigger and dml triggers?

What are magic Tables?
Magic tables are nothing but INSERTED, DELETED table scope level, These are not physical tables, only Internal tables.
select * from  inserted
select * from deleted
This two tables inserted and deleted are called magic tables.

Easy example is
Over loading is Early binding
Over ridding is late binding
what is ACID?
atomicity, consistency, isolation, and durability (ACID) .
what is load balancing?

How to make visible function in IIS, webservice on different server ?

<webServices>
     <soapExtensionTypes>
     </soapExtensionTypes>
     <protocols>
       <add name="HttpGet"/>
       <add name="HttpPost"/>
       <add name="HttpSoap"/>
     </protocols>
    </webServices>
difference B/W convert.tostring() and .tostring()?
convert.tostring() check null to .tostring() not

What is the difference between INT, INT16, INT32 and INT64?


All the type of integer has different range of storage capacity
Type Capacity
 Int 16 -- (-32768 to +32787)

  Int 32 -- (-2,147,483684 to +2,147,483683)

  Int 64 -- (-9223372036854775808 to +9223372036854775807)

Int=Int32 --> Original long type
Int16 --> Original int
Int64 --> New data type become available after 64 bit systems
"int" is only available for backward compatibility. We should be really using new int types to make our programs more precise.


Wednesday 17 July 2013

SQL Server :

Query to get nth(3rd) Highest Salary

  1. Select TOP 1 Salary as '3rd Highest Salary'
  2. from (SELECT DISTINCT TOP 3 Salary from Employee ORDER BY Salary DESC)
  3. a ORDER BY Salary ASC
for Reference 
http://www.dotnet-tricks.com/Tutorial/sqlserver/SQ23310812-Get-nth-highest-and-lowest-salary-of-an-employee.html

Self Join
Joining the table itself called self join. Self join is used to retrieve the records having some relation or similarity with other records in the same table. Here we need to use aliases for the same table to set a self join between single table and retrieve records satisfying the condition in where clause.









SELECT e1.EmpId, e1.EmpName FROM EmployeeDetails e1, EmployeeDetails e2 where e1.EmpId=e2.ManagerId;




Now if I want get the details of Empolyees who are in Manager Position for that we need to write query like this
 

Tuesday 16 July 2013


  1. To read session in jquery
       function getsessionsymbol() {/* for sessinssymbol*/
       var symbol ='<%= Session["CurrencySymbol"].ToString() %>';
       return symbol;
      }

  1. jquery like keyword
    $('div[id^="PlpSecpricediv_"]')

3.for trim in IE
if(!String.prototype.trim) {
 String.prototype.trim = function () {
   return this.replace(/^\s+|\s+$/g,'');
 };
}

4. how to  Convert json date :
json data return date in this format :

var value="/Date(1337878800000+0700)/";
if (value.substring(0, 6) == "/Date(")
{
;
}


7.   queryZero=queryZero.replace(/~/g, ',');(replace all ~ with , in jscript)
8. http://it-ebooks.info (online pdf book link)
10. var uagent = navigator.userAgent;
           if (uagent.search('Mobile') > -1|| uagent.search('Android')>-1) {
             }(find devise in jquery)
12.Response.ClearContent();(for clear aspx content.)
   Response.Write("false");
   Response.End()

13. http://www.addthis.com/(social sharing website.)
14.  function pageLoad() {  
       $(function(){
       //GridListFun();

       });
         
       }    //ready function for run script after ajax call

15. $('a.contact').toggle(function(){
   
// odd clicks
},
function(){
   
// even clicks
});  ///for alternate click

16.Convert.ToString(System.IO.Path.GetFileName(Request.PhysicalPath))

17.C:\Windows\system32>C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.
exe -i (configure iis)



Saturday 13 July 2013

About IT

The combination of telecommunication and computer science for the capture, storage and transmission of information to every nook and corner of the world is said to be IT.

रूस-यूक्रेन संकट लाइव: भारतीयों को 'उपलब्ध किसी भी साधन' के माध्यम से कीव को तत्काल छोड़ने के लिए कहा

  रूस यूक्रेन संकट लाइव: कीव में भारतीय दूतावास ने मंगलवार को जारी एक एडवाइजरी में भारतीयों को  'किसी भी उपलब्ध साधन' के माध्यम से क...