Thursday, April 9, 2020

Beautiful Bottle planters made out of waste bottles

Beautiful Bottle planters made out of waste bottles

Hi friends,
Today I am sharing my new creation - a beautiful Lord Ganesha face hanging plant pot from old oil bottle and a tribal lady faced plastic bottle planter out of used Vim dish-wash liquid bottle. Hope you will like the idea and create best out of waste.



Wednesday, March 18, 2009

In SQL Server convert data from UpperCase to TitleCase

--Create the following function in the sql server

CREATE function INITCAP (@inString varchar(4000) )
returns varchar(4000)
as
BEGIN
DECLARE @i int, @c char(1),@result varchar(255)
SET @result=LOWER(@inString)
SET @i=2
SET @result=STUFF(@result,1,1,UPPER(SUBSTRING(@inString,1,1)))
WHILE @i<=LEN(@inString)
BEGIN
SET @c=SUBSTRING(@inString,@i,1)
IF (@c=' ') OR (@c=';') OR (@c=':') OR (@c='!') OR (@c='?') OR (@c=',')OR (@c='.')OR (@c='_')
IF @i
BEGIN
SET @i=@i+1
SET @result=STUFF(@result,@i,1,UPPER(SUBSTRING(@inString,@i,1)))
END
SET @i=@i+1
END
RETURN @result
END

--And call it inside the stored procedure or in query as follows:
select top 10 dbo.INITCAP(city) from newleads

/* This function returns char, with the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric */

Friday, March 13, 2009

How to calculate Average with 2 decimal places in SQL Server

I have following query to find average in SQL Server
select top 10 cast(avg(cast(DATEDIFF(day, createdate, getdate()) as decimal)) as decimal(18,2)) as avgDays from tblTemp
Is there any optimized way to find average upto two decimal places? Thanks.

Sunday, February 8, 2009

Virus Attack: Unable to open drives using double click or right click...explore or open?

I found the answer from wiki.answers.com.

To correct and solve this error, follow these steps:

Go to the start->run.
Type "cmd" (without quotes) into the Open text box and click OK.
Type the following command one by one followed by hitting Enter key:
del c:\autorun.* /f /s /q /a
del d:\autorun.* /f /s /q /a
del e:\autorun.* /f /s /q /a

c, d, e are the hard disk drives/partitions. If there are more drives or partitions available, continue to command by altering to other drive letter. Note that you must also clean the autorun files from USB flash drive or portable hard disk as the external drive may also be infected.

Again click Start->run
Type "regedit" (without quotes) into the Open text box and click OK.
Navigate to the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

>>Check if the value name and value data for the key is correct (the value data of userint.exe include the path which may be different than C drive, which is also valid, note also the comma which is also needed):
"Userinit"="C:\WINDOWS\system32\userinit.exe," <<

If the value is incorrect, modify it to the valid value data.

Wednesday, March 12, 2008

Asp.Net Interview Question

Question.How can I change private assembly to shared assembly?
Ans. step1. Get the SN using sn.exe
step2. Add the SN to the Assembly
step3. Put the Assembly in GAC.

Question: What is the difference between an Interface and an Abstract class ?
Answer :An Interface is used to define methods(have no Body) but not for the implementation whereas An abstract class can be used to implement the Methods.
An Interface allows us to use multiple inheritence but not Abstract Classes.
A Class can implement more than one Interface but can be inherited from only one Class.
Interfaces are slow while Abstract classes are fast.

If various implementations shares only share method signature then it is better to use Interface whereas if implementations also use common behaviour then Abstract class is better to use.

Question: Explain CLR ?
Answer:
The Common Language Runtime(CLR) is most important part of .Net Framework even for .Net Technology. It reduces the amount of code developer need to write because it provides a variety of execution services that include Memory Management, thread Management, component management etc. The key role of CLR is that it provides these execution services to all the applications regardless of what programming they're written in and without any additional effort on the programmer.
The CLR Compiles the code just before execution. Actually Instead of producing a binary representation of code , .Net compilers produces a code in a language which is common to .Net framework (called MSIL means MicroSoft Intermediate Language) . When your source code executes for the first time, CLR invokes a special compiler called Just In Time(JIT) compiler, which converts this MSIL into executable code that is specific to the type and the model of your system's processor.

Question: What is DLL Hell Problem?
Answer:
DLL Hell points to a Set of problems caused when multiple applications attempt to share a common component like a COM or DLL. The most common and troublesome problem was overwriting a working system DLL with a new version causing some applications to fail.

To understand it well let's take a case. Suppose one application installs a new version of shared component that has not backward compatability with the version that is already on the machine.Although the application that has just been installed works well but the problem arise when existing applications that depends on the previous version might no longer works.

.Net supports strong binding. Strong binding means an application or component can bind to a specific version of a component, so that you can reuse component or use them isolation. When a .Net component is installed onto the machine, the GAC creates a Strong Name for the component. The component is then registered in the repository and indexed by it's strong Name, so there is no confusion between different versions of the same component or DLL.

Question: What is PostBack ?
Answer:
A postBack is a process in which, when a Page sends a request to the server then the server process the request and Page is submitted to itself.
When a PostBack occurs .......

The current value of controls on Page are contained in the PostBack request and called Post Data.
The content of ViewState are also in the Post Data.
In order to understand PostBack, Page Life Cycle Helps a lot.

Question: List the differences between Ado.net DataSet and ADO RecordSet ?
Answer

RecordSet is Used for a Single table While With DataSet we can work upon multiple tables.
RecordSet is Limited to Single database while DataSet can host tables from multiple databases.
DataSet can also store the relations between the Tables.
A connection should be estabilished every time whenever we work on recordset While DataSet works in disconnected environment.
RecordSet is a concept of ADO while DataSet is a concept of ADO.Net.
DataSet is XML Based.

Question: What is an Assembly and define there types?
Answer:
An Assembly can be defined as a compiled code library which is used for deployment, versioning and security.It is a logical unit of code which is of two types (1) DLL and (2) EXE.
Even One Assembly can contain many files.
In .Net when you compile your source code then the exe or dll generated is actually an assembly. The information of Assembly is contained in assembly's menifest.

Assembly's are of two types......

Private Assembly : An assembly which is used by a single application is called private assembly. Suppose you created a DLL which contains your Bussiness Logic, then this DLL will be your client application only.
Shared Assembly : Assembly which is used by many appliocations is called shared assembly. It is present in GAC and have a strong name.

Question: What is a Strong Name ?
Answer: A strong name is assembly's Identity which consists assembly's text name, version number , culture information( if provided), public key and a digital signature.
Strong name assemblies are no different from other assemblies except for the fact that they are stored in Global Assembly Cache and could be used across different applications.

Question : Explain View State ?
Answer: View State is a state management property of asp.net that retain values across two successive requests for the same page. By default the state is persisted on the client using a hidden field added to the page and is restored on the server before the page request is processed. The View State travels back and forth with the page itself.

Since it's a physical part of the age , it's fast to retrieve and use but it can also become a weakness as it adds a few extra Kb of data as payload. Because it's composed of plain text so it could be tempered and so programmers are not supposed to store sensitive data in the view state (like credit card numbers, passwords etc.).

View State does not hold the controls, rather it holds the values of the form controls and their ID's. It is not used to hold Session data ot to transmit data between pages.

Question: What is GAC ?
answer:
Global Assembly Cache is a machine-wide code cache which stores assemblies specifically designated to be shared by several applications on the computer, so that all the applications can use it.

Assemblies should be stored in GAC only when needed, otherwise keep assemblies private and locate in application directory only. Also it is not necessary to install assemblies into GAC to make then available to COM,interop or unmanaged code.

Assemblies deployed in the GAC must have a strong name.When an assembly is added to the Global Assembly Cache, integrity checks are performed on all files.The Integrity checks are performed to ensure that an assembly has not been tempered with , i.e. File has changed but the menifest does not reflect that change.

Question: What is CTS ?
Answer :
Common Type System(CTS) defines how types are declared, used and managed in the runtime and also support cross language Integration and type safety. It defines rules that languages must follow so that they can interact with each other.

Question: What is CLS ?
Answer:
The Common Language Specification (CLS) is simply a specification that defines the rules to support language integration in such a way that programs written in any language can interoperate with other languages, taking full advantage of inheritance, polymorphism, exception, and other features.

Question: What is the purpose of Global.asax ?
Answer:
Global.asax is used to define all Session and Application level events, which include Session_Start, Session_End, Application_Start, Application_End and Application_Error events.

Question : What is Portable Executable (PE) ?
Answer:
PE is a File Format that all Executable Files (EXE) and Dynamic Link Libraries (DLL) must Follow. PE is derived from the Microsoft Common Object File Format (COFF). The exe and dll files created using the .Net Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.

Question: Name the stages of Page Load Lifecycle ?
Answer:
There are four Stages......

Init
Load
PreRender
Unload

Question: How many types of directives are in asp.net and name them ?
Answer :
There are 9 types of directives and these are.......

@Page directive
@Register directive
@Import directive
@Assembly directive
@Implements directive
@Reference directive
@OutputCache directive
@MasterType
@PreviousPageType
Question: What is the difference between Response.Write( ) and Response.Output.Write( ) ?
Answer:
Both are used to write output on the page but we can write Formatted output using Response.Output.Write( ).

Question: How will you Perform paging in a DataList control ?
Answer:
For DataList Paging goto......... Paging in dataList

Question: What is the difference between GridView's DataSourceID property and DataSource property ?
Answer :
DataSourceID property is used to bind GridView to a DataSource control whereas with DataSource property can be used to bind to any object which can include DataSet and DataReader.

Question: What is the use of TemplateField in GridView ?
Answer :
TemplateField is used to define custom column field. User can define his content for each Item in the GridView. One TemplateField is used for one item.

Question: Which Command line tool is used to configure Sql server so that it can support SQL Cache invalidation ?
Answer :
The Command line tool is...

aspnet_regsql

The location of this tool is

For Windows XP....
C:\Windows\Microsoft.Net\Framework\version of .net

For Windows 2000...
C:\Winnt\Microsoft.Net\Framework\version of .net

Question: How do u provide focus in the TextBox control when the page load's ?
Answer :
For Answer please visit the following link...

Default Focus on Page Load


Question: Does HyperLink control support click event ?
Answer :
No. Hyperlink doesn't support click event.To navigate we have to set the NavigateUrl property of the HyperLink.
LinkButton Control supports the click event.

Thursday, October 18, 2007

silverLight

Microsoft Silverlight (code-named Windows Presentation Foundation/Everywhere or WPF/E) is a proprietary runtime for browser-based Rich Internet Applications, providing a subset of the animation, vector graphics, and video playback capabilities of Windows Presentation Foundation. The runtime is available for Microsoft Windows and Mac OS X, with Linux support under development via the third-party Moonlight runtime.

Silverlight aims to compete with Adobe Flash and the presentation components of Ajax. It also competes with Sun Microsystems' JavaFX, which was launched a few days after Silverlight.

Sunday, December 10, 2006

New features of asp.net2.0

There are more than 50 new server controls in asp.net 2.0