string sValue = "563";
string sOutput = sValue.PadLeft(5, '0');
Wednesday, September 30, 2009
Tuesday, September 29, 2009
What is dual listing -- Good article ADR/GDR
http://business.rediff.com/report/2009/sep/29/perfin-what-is-dual-listing-and-why-india-may-not-adopt-it.htm
Sunday, September 27, 2009
look young
Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.
Saturday, September 26, 2009
Silverlight tutorials
http://www.davidezordan.net/blog/?p=1436
http://www.smartwebcontrols.com/video/
http://www.smartwebcontrols.com/video/
Wednesday, September 23, 2009
Simple Recursive example C#
#purpose : method to get the decimal position based on passed number
private static int GetDividebyValue(int dec_position)
{
return ((dec_position == 1) ? 1 : (10 * GetDividebyValue(dec_position - 1)));
}
//calling method
int dividby = GetDividebyValue(decimal_position+1);
private static int GetDividebyValue(int dec_position)
{
return ((dec_position == 1) ? 1 : (10 * GetDividebyValue(dec_position - 1)));
}
//calling method
int dividby = GetDividebyValue(decimal_position+1);
Monday, September 14, 2009
installutil.exe -- exited with code -1
Powershell
if you open the visual studion without Administrator mode you will get
"existed with code -1" error,
open the visual studio as a 'administrator' and run open and compile the powershell project.
happy coding
if you open the visual studion without Administrator mode you will get
"existed with code -1" error,
open the visual studio as a 'administrator' and run open and compile the powershell project.
happy coding
Saturday, September 12, 2009
visual studio add-ins
http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&discussionID=7028171&gid=43315&trk=EML_anet_qa_ttle-cDhOon0JumNFomgJt7dBpSBA
Friday, September 11, 2009
The ' ' character, hexadecimal value 0x20, cannot be included in a name
While creating XElement or XMLElement from C# code,
probably you will get below error
Error:
The ' ' character, hexadecimal value 0x20, cannot be included in a name.
Solution:
XElement/attribute does not contain space between node name, make sure your node name doesn't have white spaces.
for example
<Row Total Cost="" />
change to
<Row TotalCost="" />
if you notice second one there is no white space on Attribute TotalCost
hope this helps
probably you will get below error
Error:
The ' ' character, hexadecimal value 0x20, cannot be included in a name.
Solution:
XElement/attribute does not contain space between node name, make sure your node name doesn't have white spaces.
for example
<Row Total Cost="" />
change to
<Row TotalCost="" />
if you notice second one there is no white space on Attribute TotalCost
hope this helps
Friday, September 4, 2009
Delete Remove duplicate in SQL
1) find duplicate
select name,city,COUNT(1)
from mytable
group by name,city
having COUNT(1) > 1
2) remove duplicate - best way
CREATE TABLE #Table1 (col1 int, col2 int)
INSERT INTO #Table1 VALUES (1, 1000)
INSERT INTO #Table1 VALUES (2, 2000)
INSERT INTO #Table1 VALUES (2, 2000)
INSERT INTO #Table1 VALUES (3, 3000)
INSERT INTO #Table1 VALUES (3, 3000)
INSERT INTO #Table1 VALUES (4, 4000)
SELECT * FROM #Table1;
WITH T1 AS (SELECT (ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col1)) AS RNum FROM #Table1)
DELETE FROM T1 WHERE RNum IN (SELECT a.RNum FROM T1 AS a, T1 AS b WHERE a.RNum > b.RNum GROUP BY a.RNum)
SELECT * FROM #Table1
DROP TABLE #Table1
3) remove duplicate
SELECT DISTINCT * INTO tab2 FROM tab1 — distinct of all columns
DROP TABLE tab1
EXEC sp_rename ‘tab2′,’tab1′
4) remove duplicate
don't want to tab1
--get distinct duplicate records in #tempTable using option1
--remove all duplicate records from mail table
--insert #tempTable records in to tab1
--drop #tempTable
select name,city,COUNT(1)
from mytable
group by name,city
having COUNT(1) > 1
2) remove duplicate - best way
CREATE TABLE #Table1 (col1 int, col2 int)
INSERT INTO #Table1 VALUES (1, 1000)
INSERT INTO #Table1 VALUES (2, 2000)
INSERT INTO #Table1 VALUES (2, 2000)
INSERT INTO #Table1 VALUES (3, 3000)
INSERT INTO #Table1 VALUES (3, 3000)
INSERT INTO #Table1 VALUES (4, 4000)
SELECT * FROM #Table1;
WITH T1 AS (SELECT (ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col1)) AS RNum FROM #Table1)
DELETE FROM T1 WHERE RNum IN (SELECT a.RNum FROM T1 AS a, T1 AS b WHERE a.RNum > b.RNum GROUP BY a.RNum)
SELECT * FROM #Table1
DROP TABLE #Table1
3) remove duplicate
SELECT DISTINCT * INTO tab2 FROM tab1 — distinct of all columns
DROP TABLE tab1
EXEC sp_rename ‘tab2′,’tab1′
4) remove duplicate
don't want to tab1
--get distinct duplicate records in #tempTable using option1
--remove all duplicate records from mail table
--insert #tempTable records in to tab1
--drop #tempTable
Tuesday, September 1, 2009
Quote of the day
The indispensable first step to getting the things you want out of life is this: decide what you want.
Subscribe to:
Posts (Atom)