Many times user create a windows service and add installer to it, but when user try to install, it will installed successfully but dosn't appear in service list.
use the below mentioned steps to find a best solution:
Add a custom action to the setup project.
1.In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom Actions editor appears.
2.In the Custom Actions editor, right-click the Custom Actions node and choose Add Custom Action. The Select Item in Project dialog box appears.
3.Double-click the application folder in the list box to open it, select primary output from MyNewService (Active), and click OK. The primary output is added to all four nodes of the custom actions � Install, Commit, Rollback, and Uninstall.
4.Build the setup project.
I am running this Blog to help other guys, who are looking some bits and pieces in terms of MS technology....
Monday, August 8, 2011
Thursday, August 4, 2011
Show server time in client application
Sometime client requirement is to show server time in client application, There are two options to complete this task.
1) Read server Date and Time and do postback with timer.
2) Read Server Date and Time and use Javascript to maintain right date and time.
Expamle:
<script type="text/javascript">
var currenttime = '<%#Session["ServerDateTime"]%>';
var montharray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
var serverdate = new Date(currenttime)
function padlength(what) {
var output = (what.toString().length == 1) ? "0" + what : what
return output
}
function displaytime() {
serverdate.setSeconds(serverdate.getSeconds() + 1)
var datestring = montharray[serverdate.getMonth()] + " " + padlength(serverdate.getDate()) + ", " + serverdate.getFullYear()
var timestring = padlength(serverdate.getHours()) + ":" + padlength(serverdate.getMinutes()) + ":" + padlength(serverdate.getSeconds())
document.getElementById("servertime").innerHTML = datestring + " " + timestring
}
window.onload = function () {
setInterval("displaytime()", 1000)
}
</script>
1) Read server Date and Time and do postback with timer.
2) Read Server Date and Time and use Javascript to maintain right date and time.
Expamle:
<script type="text/javascript">
var currenttime = '<%#Session["ServerDateTime"]%>';
var montharray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
var serverdate = new Date(currenttime)
function padlength(what) {
var output = (what.toString().length == 1) ? "0" + what : what
return output
}
function displaytime() {
serverdate.setSeconds(serverdate.getSeconds() + 1)
var datestring = montharray[serverdate.getMonth()] + " " + padlength(serverdate.getDate()) + ", " + serverdate.getFullYear()
var timestring = padlength(serverdate.getHours()) + ":" + padlength(serverdate.getMinutes()) + ":" + padlength(serverdate.getSeconds())
document.getElementById("servertime").innerHTML = datestring + " " + timestring
}
window.onload = function () {
setInterval("displaytime()", 1000)
}
</script>
Monday, July 4, 2011
Extension Methods in .NET 3.5
Introduction
Extension method is new to C#.Its allow you to add new method to the existing class.
Description
1.Extension method allows you to add new method to the existing class without modifying the code, recompiling or modifying the original code.
2.Extension method are special kind of static method but they are called using instance method syntax. Their first parameter specify which type the method operate on, and the parameter is precede by “this” modifier.
3.Extension method are only in scope when you explicitly import the namespace into your source code with “using” directive.
For Example in string object there is no method call “Reverse()” function .But if you need to extend the string ….
Sample Code
namespace ExtensionMethods
{
public static class ExtensionsClass
{
public static bool IsValidEmailAddress(this String EmailAddress)
{
Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
return regex.IsMatch(EmailAddress);
}
}
}
How to Use?
string email = harish@company.com;
if ( email.IsValidEmailAddress() ) {
}
Note how the static method above has a "this" keyword before the first parameter argument of type string. This tells the compiler that this particular Extension Method should be added to objects of type "string".
for more information follow the Link
Extension method is new to C#.Its allow you to add new method to the existing class.
Description
1.Extension method allows you to add new method to the existing class without modifying the code, recompiling or modifying the original code.
2.Extension method are special kind of static method but they are called using instance method syntax. Their first parameter specify which type the method operate on, and the parameter is precede by “this” modifier.
3.Extension method are only in scope when you explicitly import the namespace into your source code with “using” directive.
For Example in string object there is no method call “Reverse()” function .But if you need to extend the string ….
Sample Code
namespace ExtensionMethods
{
public static class ExtensionsClass
{
public static bool IsValidEmailAddress(this String EmailAddress)
{
Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
return regex.IsMatch(EmailAddress);
}
}
}
How to Use?
string email = harish@company.com;
if ( email.IsValidEmailAddress() ) {
}
Note how the static method above has a "this" keyword before the first parameter argument of type string. This tells the compiler that this particular Extension Method should be added to objects of type "string".
for more information follow the Link
Wednesday, June 22, 2011
280 लाख करोड़ का सवाल है ..
280 लाख करोड़ का सवाल है ...
भारतीय गरीब है लेकिन भारत देश कभी गरीब नहीं रहा"* ये कहना है स्विस बैंक के
डाइरेक्टर का. स्विस बैंक के डाइरेक्टर ने यह
भी कहा है कि भारत का लगभग 280
लाख करोड़
रुपये उनके स्विस
बैंक में जमा है. ये रकम
इतनी है कि भारत का आने वाले 30 सालों का बजट
बिना टैक्स के
बनाया जा सकता
है.
या यूँ कहें कि 60 करोड़
रोजगार के अवसर
दिए जा सकते है. या यूँ भी कह सकते है
कि भारत के किसी भी गाँव से दिल्ली तक 4
लेन रोड बनाया
जा सकता है. ऐसा भी कह
सकते है कि 500 से ज्यादा सामाजिक प्रोजेक्ट पूर्ण किये जा सकते है. ये
रकम
इतनी ज्यादा है कि अगर हर भारतीय को 2000 रुपये हर महीने भी दिए जाये तो 60
साल तक ख़त्म ना हो. यानी भारत को किसी वर्ल्ड बैंक से लोन लेने कि कोई जरुरत
नहीं है. जरा सोचिये ... हमारे भ्रष्ट राजनेताओं
और नोकरशाहों ने
कैसे देश को
लूटा है और ये लूट का सिलसिला अभी तक 2011 तक जारी है.
इस सिलसिले को
अब रोकना
बहुत ज्यादा जरूरी हो गया है. अंग्रेजो ने हमारे भारत पर करीब 200 सालो तक राज
करके करीब 1 लाख
करोड़ रुपये लूटा. मगर आजादी के केवल 64 सालों में हमारे भ्रस्टाचार ने 280
लाख करोड़ लूटा है. एक तरफ 200 साल में 1 लाख करोड़ है और दूसरी तरफ केवल 64
सालों में 280 लाख करोड़ है. यानि हर साल लगभग 4.37लाख करोड़, या हर महीने
करीब 36 हजार करोड़ भारतीय मुद्रा स्विस बैंक में इन भ्रष्ट
लोगों द्वारा जमा
करवाई गई है. भारत को किसी वर्ल्ड बैंक के लोन की कोई दरकार नहीं है. सोचो की
कितना पैसा हमारे भ्रष्ट राजनेताओं और उच्च अधिकारीयों ने ब्लाक करके
रखा हुआ
है. हमे भ्रस्ट राजनेताओं और भ्रष्ट अधिकारीयों के खिलाफ जाने का पूर्ण अधिकार
है.हाल ही में हुवे घोटालों का
आप सभी को पता ही है - CWG घोटाला, २ जी
स्पेक्ट्रुम घोटाला , आदर्श होउसिंग घोटाला ... और ना जाने कौन कौन
से घोटाले
अभी उजागर होने वाले है ........आप लोग जोक्स फॉरवर्ड करते ही हो. इसे भी इतना
फॉरवर्ड करो की पूरा भारत
इसे पढ़े ... और एक आन्दोलन बन जाये
भारतीय गरीब है लेकिन भारत देश कभी गरीब नहीं रहा"* ये कहना है स्विस बैंक के
डाइरेक्टर का. स्विस बैंक के डाइरेक्टर ने यह
भी कहा है कि भारत का लगभग 280
लाख करोड़
रुपये उनके स्विस
बैंक में जमा है. ये रकम
इतनी है कि भारत का आने वाले 30 सालों का बजट
बिना टैक्स के
बनाया जा सकता
है.
या यूँ कहें कि 60 करोड़
रोजगार के अवसर
दिए जा सकते है. या यूँ भी कह सकते है
कि भारत के किसी भी गाँव से दिल्ली तक 4
लेन रोड बनाया
जा सकता है. ऐसा भी कह
सकते है कि 500 से ज्यादा सामाजिक प्रोजेक्ट पूर्ण किये जा सकते है. ये
रकम
इतनी ज्यादा है कि अगर हर भारतीय को 2000 रुपये हर महीने भी दिए जाये तो 60
साल तक ख़त्म ना हो. यानी भारत को किसी वर्ल्ड बैंक से लोन लेने कि कोई जरुरत
नहीं है. जरा सोचिये ... हमारे भ्रष्ट राजनेताओं
और नोकरशाहों ने
कैसे देश को
लूटा है और ये लूट का सिलसिला अभी तक 2011 तक जारी है.
इस सिलसिले को
अब रोकना
बहुत ज्यादा जरूरी हो गया है. अंग्रेजो ने हमारे भारत पर करीब 200 सालो तक राज
करके करीब 1 लाख
करोड़ रुपये लूटा. मगर आजादी के केवल 64 सालों में हमारे भ्रस्टाचार ने 280
लाख करोड़ लूटा है. एक तरफ 200 साल में 1 लाख करोड़ है और दूसरी तरफ केवल 64
सालों में 280 लाख करोड़ है. यानि हर साल लगभग 4.37लाख करोड़, या हर महीने
करीब 36 हजार करोड़ भारतीय मुद्रा स्विस बैंक में इन भ्रष्ट
लोगों द्वारा जमा
करवाई गई है. भारत को किसी वर्ल्ड बैंक के लोन की कोई दरकार नहीं है. सोचो की
कितना पैसा हमारे भ्रष्ट राजनेताओं और उच्च अधिकारीयों ने ब्लाक करके
रखा हुआ
है. हमे भ्रस्ट राजनेताओं और भ्रष्ट अधिकारीयों के खिलाफ जाने का पूर्ण अधिकार
है.हाल ही में हुवे घोटालों का
आप सभी को पता ही है - CWG घोटाला, २ जी
स्पेक्ट्रुम घोटाला , आदर्श होउसिंग घोटाला ... और ना जाने कौन कौन
से घोटाले
अभी उजागर होने वाले है ........आप लोग जोक्स फॉरवर्ड करते ही हो. इसे भी इतना
फॉरवर्ड करो की पूरा भारत
इसे पढ़े ... और एक आन्दोलन बन जाये
Thursday, June 2, 2011
How to search any specific string in a procedure, stored procedure and many other information.
If you need to find how many DB objects a person created and what is the created and modified date.
Please use the following sql statement for this:
SELECT *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%search_string%'
AND ROUTINE_TYPE = 'PROCEDURE'
Please use the following sql statement for this:
SELECT *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%search_string%'
AND ROUTINE_TYPE = 'PROCEDURE'
Friday, May 27, 2011
Hide Console Window in Console Application with C#
1) First write below code above your console main method:
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
2) Put below line of code in starting of main Method
// hide the console window
setConsoleWindowVisibility(false, Console.Title);
3) use below lie of code in your class
public static void setConsoleWindowVisibility(bool visible, string title)
{
//Sometimes System.Windows.Forms.Application.ExecutablePath works for the caption depending on the system you are running under.
IntPtr hWnd = FindWindow(null, title);
if (hWnd != IntPtr.Zero)
{
if (!visible)
//Hide the window
ShowWindow(hWnd, 0); // 0 = SW_HIDE
else
//Show window again
ShowWindow(hWnd, 1); //1 = SW_SHOWNORMA
}
}
Finally you will see your console window hide.
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
2) Put below line of code in starting of main Method
// hide the console window
setConsoleWindowVisibility(false, Console.Title);
3) use below lie of code in your class
public static void setConsoleWindowVisibility(bool visible, string title)
{
//Sometimes System.Windows.Forms.Application.ExecutablePath works for the caption depending on the system you are running under.
IntPtr hWnd = FindWindow(null, title);
if (hWnd != IntPtr.Zero)
{
if (!visible)
//Hide the window
ShowWindow(hWnd, 0); // 0 = SW_HIDE
else
//Show window again
ShowWindow(hWnd, 1); //1 = SW_SHOWNORMA
}
}
Finally you will see your console window hide.
Friday, May 20, 2011
Inserting duplicate records in Primary key field
One time I seen a duplicate entry in table primary key field,
that's strange for me or everyone, who don't know about this. But It's possible.
please follow the instructions:
1) let first us create a table:
create table testTable(
testempno number(9) primary key,
testename varchar2(50)
);
2) Insert some valid records into the table.
insert into testTablevalues(1,'test1');
insert into testTable values(2,'test2');
commit;
TESTEMPNO TESTENAME
1 test1
2 test2
3) Find out the constraint name for the primary key:
SELECT CONSTRAINT_NAME FROM USER_CONSTRAINTS WHERE TABLE_NAME LIKE 'testTable' ;
CONSTRAINT_NAME
SYS_C00111110
4) Disable the constraint:
ALTER TABLE testTable DISABLE CONSTRAINT SYS_C00111110;
5) Check whether the index for the field is enabled or not:
select index_name,index_type from user_indexes where table_name like 'testTable';
It should return no rows returned. If otherwise returned drop the index.
6) Now insert the duplicate record:
INSERT INTO testTable VALUES (1,'testDuplicate');
7) Now create a non-unique index on the field:
CREATE INDEX testTable_INDEX ON testTable(testempno);
8) And at final enable the primary key constraint:
ALTER TABLE testTable ENABLE NOVALIDATE CONSTRAINT SYS_C00111110;
Now give a select * from testTable;
TESTEMPNO TESTENAME
1 test1
2 test2
1 testDuplicate
9)Now you have a enabled primary key constraint with a violated data:
SELECT CONSTRAINT_NAME,STATUS FROM USER_CONSTRAINTS WHERE TABLE_NAME='testTable';
CONSTRAINT_NAME STATUS
SYS_C00111110 ENABLED
For More Info Click Here
that's strange for me or everyone, who don't know about this. But It's possible.
please follow the instructions:
1) let first us create a table:
create table testTable(
testempno number(9) primary key,
testename varchar2(50)
);
2) Insert some valid records into the table.
insert into testTablevalues(1,'test1');
insert into testTable values(2,'test2');
commit;
TESTEMPNO TESTENAME
1 test1
2 test2
3) Find out the constraint name for the primary key:
SELECT CONSTRAINT_NAME FROM USER_CONSTRAINTS WHERE TABLE_NAME LIKE 'testTable' ;
CONSTRAINT_NAME
SYS_C00111110
4) Disable the constraint:
ALTER TABLE testTable DISABLE CONSTRAINT SYS_C00111110;
5) Check whether the index for the field is enabled or not:
select index_name,index_type from user_indexes where table_name like 'testTable';
It should return no rows returned. If otherwise returned drop the index.
6) Now insert the duplicate record:
INSERT INTO testTable VALUES (1,'testDuplicate');
7) Now create a non-unique index on the field:
CREATE INDEX testTable_INDEX ON testTable(testempno);
8) And at final enable the primary key constraint:
ALTER TABLE testTable ENABLE NOVALIDATE CONSTRAINT SYS_C00111110;
Now give a select * from testTable;
TESTEMPNO TESTENAME
1 test1
2 test2
1 testDuplicate
9)Now you have a enabled primary key constraint with a violated data:
SELECT CONSTRAINT_NAME,STATUS FROM USER_CONSTRAINTS WHERE TABLE_NAME='testTable';
CONSTRAINT_NAME STATUS
SYS_C00111110 ENABLED
For More Info Click Here
Subscribe to:
Posts (Atom)
Split the String values with a special character in MS Flow to convert this into Array
Many times we have a requirement to prepare the Mailing address for some of the documents, suppose there are Address Line1, Address Line2, ...