1. Consider following code block,
-------------------------------------------------------------
public class A
{
public A()
{
B objB = new B();
Console.WriteLine("A constructor.")
}
}
public class B
{
public B()
{
A objA = new A();
Console.WriteLine("B constructor");
}
}
static void main()
{
A objNewA = new A();
}
---------------------------------------------------
Q: What would be output of the above code when executed? (C# code)
2. What is ASP.NET pipeline?
3. Say you have a milion of record need to be cached for your ASP.NET web application. What would be available options for caching mechanism considering fast access and critical data?
4. In case your answer is "StackOverflow exception happens" for question number 1, then tell us why exception type is "StackOverflow" because as it is seen in the code, that both A and B's constructors are creating new instances of type A/B and new objects are stored in "heap" and not on "Stack". Why it is still then "StackOverflow exception"????
There are couple of more questions too. But I need to memorise it. I would post them as soon as I remember and frame it correctly.
Happy reading !!!!
Cheers,
Tuesday, August 31, 2010
Monday, October 5, 2009
VC++ in VS 2008 - Part 2- Adding a cpp file having code
After my first small "class A" program in VS 2008, I moved forward to add the same code in a separate file and to access/call that class object in my main program file. I want to mention that I have added a new cpp file by right clicking on the solution and then Add -> New Item -> C++ file(.cpp). I have given my newly added cpp file as "A.cpp".
Therefore I have(1) "VCApp.cpp" having "main" function. (2) "A.cpp" is new file name where I want to add my class A. And then I want to access that class in my main function.
Following is my defination of class "A" which I want to put in "A.cpp"
public class A{
public:
A()
{
Console::WriteLine("Inside A constructor.");
};
};
and I access the class A in my main function as following way ,
int main(array ^args)
{
A* o = new A();
return 0;
}
I put above code and while building, found following compile time error(s),
----------------------------------------------------------------------------------
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
error C2065: 'A' : undeclared identifier
error C2065: 'o' : undeclared identifier
error C2061: syntax error : identifier 'A'
----------------------------------------------------------------------------------
To get around of this error (1) Add the following line in A.cpp at the top of it.
#include "stdafx.h"
(2) Add the following line to the top of "VCApp.cpp" file,
#include "A.cpp" ---- adding this line helps compiler to refer defination class A to find in "A.cpp" file.
Now if I compile the code then there is no compile time error and I got following out put in my console output,
Inside A constructor.
Press any key to continue . . .
Happy coding !!!
Therefore I have(1) "VCApp.cpp" having "main" function. (2) "A.cpp" is new file name where I want to add my class A. And then I want to access that class in my main function.
Following is my defination of class "A" which I want to put in "A.cpp"
public class A{
public:
A()
{
Console::WriteLine("Inside A constructor.");
};
};
and I access the class A in my main function as following way ,
int main(array
{
A* o = new A();
return 0;
}
I put above code and while building, found following compile time error(s),
----------------------------------------------------------------------------------
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
error C2065: 'A' : undeclared identifier
error C2065: 'o' : undeclared identifier
error C2061: syntax error : identifier 'A'
----------------------------------------------------------------------------------
To get around of this error (1) Add the following line in A.cpp at the top of it.
#include "stdafx.h"
(2) Add the following line to the top of "VCApp.cpp" file,
#include "A.cpp" ---- adding this line helps compiler to refer defination class A to find in "A.cpp" file.
Now if I compile the code then there is no compile time error and I got following out put in my console output,
Inside A constructor.
Press any key to continue . . .
Happy coding !!!
Exploring VC++ in Visual Studio 2008
Last couple of day I had been thinking of doing some hands on C++. So I have my VS 2008 editor and I leaverage the facilities out of it and started my C++ coding ( After many a years ... possibly after graduation days !!!)
I created a new Project from File->New ->Project -> CLR Console Application then I gave a name "VCApp".
In the project solution I can see that "VCApp.cpp" is the file where I can add my code/any custom written class.
When I have added a custom class named "A". Following is my code for my custom class,
public class A
{
public:
A()
{
Console::WriteLine("Inside A constructor.");
}
}
Though above is a very simple code snippet I was surprised to see following compile time errors
---------------------------------------------------------------------------------------
error C2628: 'A' followed by 'int' is illegal (did you forget a ';'?)
error C3874: return type of 'main' should be 'int' instead of 'A'
error C2664: 'A::A(const A &)' : cannot convert parameter 1 from 'int' to 'const A &'
---------------------------------------------------------------------------------------
I just did a quick inspection in my code then then found that code needs the scope termination operator ";" in proper places. So I modified as following ,
public class A{
public:
A()
{
Console::WriteLine("Inside A constructor.");
};
} ;
Just added a semicolon (1) while closing at end of constructor and (2) End of class and I found the build was succeeded.
I created a new Project from File->New ->Project -> CLR Console Application then I gave a name "VCApp".
In the project solution I can see that "VCApp.cpp" is the file where I can add my code/any custom written class.
When I have added a custom class named "A". Following is my code for my custom class,
public class A
{
public:
A()
{
Console::WriteLine("Inside A constructor.");
}
}
Though above is a very simple code snippet I was surprised to see following compile time errors
---------------------------------------------------------------------------------------
error C2628: 'A' followed by 'int' is illegal (did you forget a ';'?)
error C3874: return type of 'main' should be 'int' instead of 'A'
error C2664: 'A::A(const A &)' : cannot convert parameter 1 from 'int' to 'const A &'
---------------------------------------------------------------------------------------
I just did a quick inspection in my code then then found that code needs the scope termination operator ";" in proper places. So I modified as following ,
public class A{
public:
A()
{
Console::WriteLine("Inside A constructor.");
};
} ;
Just added a semicolon (1) while closing at end of constructor and (2) End of class and I found the build was succeeded.
Wednesday, August 19, 2009
The value violated the integrity constraints for the column.
I was trying to import data from one database server table to another database server table when I was getting this error message
SQL SSIS data import wizard error: "
The value violated the integrity constraints for the column.".(SQL Server Import and Export Wizard)"
The value violated the integrity constraints for the column.".(SQL Server Import and Export Wizard)"
After several times of troubleshooting to fix the problem and to import data successfuly I have noticed that there one was column in the source table which marked as "NULL" but the same colun in destination table was marked as "NOT NULL". Which caused the error.
Therefore what was happning ,some null value was getting inserted in NOT NULL column which SSIS does not allow and throws an exception saying integrity constraint would be violated.
Tuesday, October 21, 2008
Sample Query In TOAD using a 'date' variable:
====================================================================
declare dt date;
pp varchar(100);
begin
dt:=TO_DATE('2008/04/25', 'yyyy/mm/dd');
select CEIL((SYSDATE - 180) - Decode(dt,null,(SYSDATE - 180),dt)) into pp from dual;
dbms_output.PUT_LINE(pp);
end;
====================================================================
declare dt date;
pp varchar(100);
begin
dt:=TO_DATE('2008/04/25', 'yyyy/mm/dd');
select CEIL((SYSDATE - 180) - Decode(dt,null,(SYSDATE - 180),dt)) into pp from dual;
dbms_output.PUT_LINE(pp);
end;
Monday, September 22, 2008
Lyrics of Oho kiku eruthe
Lyrics of Oho kiku eruthe
Movie name:Padiyappa
Starring: Rajanikanth, Soundarya
Music: A R Rahman
Singer: SPB
Language: Tamil
ohoho kicku yerudhe
ohoho vetkam ponadhe
uLLukkuley nyaanam oorudhe
uNNmai ellaam solla thonudhe
verum kampangali thinnavanum mannukkuLLa
ada thangapaspam thinnavanum mannukkuLLa
indha vaazhkai vaazha thaan
naam pirakkayil kaiyil enna kondu vandhom kondhu sella?
(ohoho..)
paNaththai pooti vaithai
vairathai pooti vaithai
uyirai poota edhu pootu?
kuzhandhai nyaani, indha iruvarai thavira
inge sugamaai iruppadhu yaar kaatu
jeevan irukkummattum
vaazhkai namadhumattum
idhudhaan nyaanasidhdhar paatu
indha bhoomi samam namakku
nam theruvukkuL
madasandai jaadhidsandai vambyerdharkku?
(ohoho...)
thaayai therndhekkum
thandhayai therndhekkum
urimai unnidhathil illai
mugaththai therndhekkum
niraththai therndhekkum
urimai unnidhathil illai
pirappai therndhekkum
irappai therndhekkum
urimai unnidhathil illai
eNNi paarkkum vELaiyil
un vaazhkai mattum
undhan kaiyil undu
adhai vendridu!
Movie name:Padiyappa
Starring: Rajanikanth, Soundarya
Music: A R Rahman
Singer: SPB
Language: Tamil
ohoho kicku yerudhe
ohoho vetkam ponadhe
uLLukkuley nyaanam oorudhe
uNNmai ellaam solla thonudhe
verum kampangali thinnavanum mannukkuLLa
ada thangapaspam thinnavanum mannukkuLLa
indha vaazhkai vaazha thaan
naam pirakkayil kaiyil enna kondu vandhom kondhu sella?
(ohoho..)
paNaththai pooti vaithai
vairathai pooti vaithai
uyirai poota edhu pootu?
kuzhandhai nyaani, indha iruvarai thavira
inge sugamaai iruppadhu yaar kaatu
jeevan irukkummattum
vaazhkai namadhumattum
idhudhaan nyaanasidhdhar paatu
indha bhoomi samam namakku
nam theruvukkuL
madasandai jaadhidsandai vambyerdharkku?
(ohoho...)
thaayai therndhekkum
thandhayai therndhekkum
urimai unnidhathil illai
mugaththai therndhekkum
niraththai therndhekkum
urimai unnidhathil illai
pirappai therndhekkum
irappai therndhekkum
urimai unnidhathil illai
eNNi paarkkum vELaiyil
un vaazhkai mattum
undhan kaiyil undu
adhai vendridu!
Friday, September 5, 2008
How to use TOAD for to write oracle PL SQL?
1. Multiple SELECT statement can not be executed in TOAD
2. Simplest PL/SQL code in TOAD
DECLARE iDocID NUMBER(6);
BEGIN
SELECT COUNT(*) INTO iDocID FROM TBL_TW_DOCS;
DBMS_OUTPUT.PUT_LINE(iDocID);
END;
3. If a statement is returing more than one value(i.e rowset), then we can not execute using BEGIN and END.
Therefore,following code does not execute in TOAD and thows error:
4. Simplest correct code:
5. Opening an Oracle Stored Procedure ( compiled object ) in TOAD
a) Click on new procedure window.
b) New procedure window appears as follows
c) Click on Proc tab. Procedure TAB appears as follows.
d) Click on filter button and following screen appears where user is allowed to filder by package name or SP name
Subscribe to:
Posts (Atom)
