|
Hello everyone:
Would you be able to give me some practical examples as to where I would need to implement Singleton classes?
For e.g. if you could point out the scenarios where I must or should implement a Singleton class etc. I sure would appreciate your help. Thanks in advance.
Regards,
Robert
|
|
|
|
|
Singelton classes are used when you wan't to have only one instance of a class.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Dear CWIZO:
Thanks a lot for your reply; I understand the concept of Singleton classes but for some reason I am unable to identify the scenario where I would need just one instance of a class.
In other words 'why' would I need to have just one instance of a class? A practical (real world) example will be highly appreciated . Thanks again.
Regards,
Robert
|
|
|
|
|
Well once could be a class for logging application errors. Since you don't wan't two clases write to the same file at once you make a singelton class.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Maybe I'm way off base here, but wouldn't you either want multiple instances of this class so different threads don't change property data behind one another? Or maybe a static class so threads that need to log just call methods and pass the relevant data?
|
|
|
|
|
Hi
The website i am working on uses smartnav and has done without a problem for a while. However i recently had troubles with it not letting me debug so got a fresh copy from source safe (into the same directory structure as before) now when i try to add my web reference i get:
There was an error downloading 'http://127.0.0.1/aspnet_client/system_web/1_1_4322/SmartNav.htm'.
The request failed with HTTP status 404: Object Not Found.
I understand why this is happening (smartnav.htm is not in this destination - it is infact in wwwroot - then the above directory structure).
My question is does any one know why my project is looking in the wrong directory or is it the right directory and smartnav actually is not where it should be - if so any chance of a shove in the right direction.
Any help would be much appreciated.
Cheers
Dan.
|
|
|
|
|
I developed a web service on my local workstation in ASP.NET that inserts data into an accounting package (Visual Studio 2005). It uses an API provided by the vendor. I installed the accounting software on my machine and was able to successfully build the web service. Creating the reference to the Accounting software did create 2 interop references.
Now comes the problem
I have to deploy this to a production machine. The accounting software is deployed on this machine as well, but the person that installed it deployed it using a UNC name instead of installing it to a fixed location (ie its installed to \\Fileserver\ACCPAC instead of c:\ACCPAC) - because this app will be shared by multiple users.
My webservice deploys OK, but cannot find and initialize the class it needs to do the work. I keep getting the following error:
*********
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
StackTrace: at AccpacCOMAPI.AccpacSessionClass.Init(String ObjectHandle, String AppID, String ProgramName, String AppVersion)
*************
I have picked the process apart and the only thing I find different is that the DLLs are registered differently, mine to C:\ACCPAC, and the production servers to \\Filerserver\ACCPAC
Has anyone run into this problem. I am stumped and out of ideas....
Thanks in advance for any assistance
|
|
|
|
|
hi all,
i have a header file where all values are stored as byte..
i have to convert the byte to float value..that byte is a hexadecimal number.
i tried Convert.ToSingle and got 2.072774E+09 as output.
is that correct?is there any other method for byte to float conversion.
Thanks in Advance,
sunita
|
|
|
|
|
Dear All,
i have a datagrid control with 3 columns. the first column is a template column with radio buttons. to keep the Column width fixed i added the attributes "TABLE-LAYOUT: fixed ; OVERFLOW:hidden". It is woking fin. But the problem is that the radio button column also have the same size as the remaining and it is not looking good.Can i keep the radio button column to a fixed width? at the same time i want that the cell data should be clipped if it exceeds the cell width.
ThanX in advance
Ramesh.Kanjinghat
|
|
|
|
|
you can actually word wrap the text rather than cutting it off
|
|
|
|
|
Well. Wrapping requires that the text has spaces embeded. Even it works it will increase the cell height. Actually i am providing tool tip to display the text clipped.
Ramesh.Kanjinghat
|
|
|
|
|
Yes u can give width of each column in pixels and in percentages at the design time.
Do good and have good.
|
|
|
|
|
ThanQ for the reply. I have tried that way too. but when i do so. the column with cell that have data exceeding the limit is getting enlarged as long as the data.
Ramesh.Kanjinghat
|
|
|
|
|
Hi friends,
I got the work around for the above said problem. As i am setting the property TABLE-LAYOUT:fixed, the property will be apllied at client side. So we have to set the width of the columns using css class only. Below sample will help you understand the same.
<code>DataGrid1.Attributes.Add("style","TABLE-LAYOUT: fixed; OVERFLOW: hidden");</code>
The above code will force the grid to have eqaul column widths.
<code>DataGrid1.Columns[0].ItemStyle.CssClass="SetWidth"</code>
where SetWidth is given as below in the style tag
<style>
.SetWidth4Temps { WIDTH: 40px }
</style>
Hope this will help you all.
Cheers
Ramesh.Kanjinghat
|
|
|
|
|
i have 2 dates i want to get the difference between them
i have 3 dropdwonlist (day, month,year)
i get the values from it and concatenate them in one string in the format of day/month/year and i need to get the difference between the 2 dates to know which one is the recent one
thanks
|
|
|
|
|
use DateTime.Compare Method
For Example :
DateTime.Compare(DateTime.Parse("12/12/2005"), DateTime.Now) returns -1 indicating Later is greater.
DateTime.Compare(DateTime.Now , DateTime.Parse("12/12/2005") ) returns 1
indicating Former is greater.
DateTime.Compare( DateTime.Now, DateTime.Now) returns 0 indicating both are same.
|
|
|
|
|
Create a DateTime value instead of a string.
To compare two dates you can use the regular operators, i.e. <, <=, =, !=, >, >=.
To get the difference between two dates you can subtract them. The result is a TimeSpan value.
---
b { font-weight: normal; }
|
|
|
|
|
Dim date1 As Date
Dim date2 As Date
date1 = "9/25/2006 8:02:44 PM"
date2 = "9/23/2006 8:02:44 PM"
If date1 > date2 Then
Response.Write("date1 is recent")
Else
Response.Write("date2 is recent")
End If
not the best way to do it but still you can
|
|
|
|
|
Dear ..
You can use Now() function, Just you can compare the date and month and year... such details are found in Now.compare with Now and give the Comditions and get the result,
Another way is you can take it from Query..
Rame..
|
|
|
|
|
Hi,
I have been going crazy trying to find a tutorial or something which will
clearly explain to me what ErrSub is and also how to use it to get more
specific debugging solutions.. please help!
Thank you.
|
|
|
|
|
hello dears
i want to add javascript to webapplication(asp.net)
and how to use it
ashrafhakiem
ashraf_23_2005@yahoo.com
|
|
|
|
|
|
Hi...
What kind of javascript you have to add... we can add javascript easily in asp.Net page. you can add like this in HTML page//
function test()
{
alert('This is a test Page');
}
and you can call this function in ..Onclick or Page load or what ever it is..
here i have give you the example for calling function in onclick
btnSubmit = it is a button name
btnSubmit.attributes.add("onclick","javascript:return test()";)
TRY THIS AND GIVE ME YOUR FEEDBACK.
Rame..
|
|
|
|
|
parveen_banuk, has given you the code how to call a java scrip onclick event of a button.
here is how to call that script in page load.
Dim MyString as String = "test()"
Page.RegisterStartupSvript("MyScript", MyScript)
hope this give you some ideas.
cheers
|
|
|
|
|
Hi Dears,
I have a simple question can any body helpme please.
My Question!!:
I wanted to redirect user to another NTLM authentication based ASP.NET application, and it resides in a different server and also different Domain, but with out promting login box secound time.
More Elaboratively:
I have a username and password of mytarget application, I need to redirect user to that target Application, which is configured as Windows Integrated Authentication.
Here the issue is when the user is redirected to mytarget application it is prompting for credentials, Can we avoid the login box second time?
another way can we avoid multiple login boxes.
Vijay Bhasker Reddy CH
|
|
|
|