|
Thanks friend,
Your code is so logical and it took my two hrs. for understanding it. How your made the logic in just 35 min. You are a true programmer. The code meet all my requirements and I'll use it in my Data Base program "as it is" without any changing. So thanks and so nice of you.
God Bless You
"If u read this plz send me your e-mail address."
Bye
Syed Shahid Hussain
|
|
|
|
|
Well a switch is a manual and less elegant way of doing this.
A preferred way is having all the digit equivalents in a string table, and then having the conjuntion operators in another one, and a mapping list for mapping the info. I will try to post some code on it, using the neural approach that i did 6 years back.
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
If you find code send me.
Syed Shahid Hussain
|
|
|
|
|
Hi
I have a string in format "21.05.2004" pleas tell me how to convert it to DataTime format.All time i get InvalidDataException.Pleas help me if you can.
when i want to read something good just seat and type it
|
|
|
|
|
DateTime.Parse ???
Make sure the culture is set correctly for you date format also.
only two letters away from being an asset
|
|
|
|
|
How to change the culture ???
when i want to read something good just seat and type it
|
|
|
|
|
System.Globalization.CultureInfo culture = new System.Globaliztion.CultureInfo("ru-RU"); // Russian
DateTime dt = ConvertTo.DateTime("21.05.2004",culture);
msdn site
|
|
|
|
|
Supper thank's
when i want to read something good just seat and type it
|
|
|
|
|
The System.Guid.NewGuid( ) method seems to have returned duplicate GUIDs, two days in a roll.
Is it possible? Is there any related .NET (1.0 or 1.1) bug reported for this problem?
|
|
|
|
|
|
Hi,could you have code or link to code
For accessing Scheduled Task (windows) created by or modified by the Scheduled Task wizard.
|
|
|
|
|
I am developing windows application in .NET 1.1 using C#. I have developed a custom control for text editing in my application. Whenever i drop that control from toolbox to the form, it does not show the control on form on design time. When I run thaat form, it works pretty fine and it shows that control at run time. But at design time, the Visual Studio is not showing the control. What is the Problem that the control is not shoiwn at design time?
Thanks,
Sandeep S. Sekhon
|
|
|
|
|
If you have something in the design of the control that you do with some variable code then this occurs. For example you may be showing something that the control can only reach when the executable just runs. Something which can only have an appropriate value in runtime etc. Look for such things. You most probably have some code in control's initialize method.
|
|
|
|
|
But running the application for one time, I closed the Visual Studio. I again opened that same application, but this time the control was shown on the form.
Thanks,
Sandeep S. Sekhon
|
|
|
|
|
Hi,
My class looks like
public abstract class ShellApplicationBase<TModule, TModuleLoader> : BaseNet.Icarus.Shell.Interfaces.IShellApplication
{
}
Every class in my app should now be able to access the shell class. Therefore I wanted to implement a singleton where one could access Shell.Instance.DoNothingAndWaitInfite();
to do so i did
static IShellApplication _instance;
public IShellApplication Instance
{
get
{
return _instance;
}
}
so far so good, there is a static public IShellApplication Property on my shell class. Now one would have the idea to access this singelton inside the app
ShellApplicationBase<???>.Instance.DoNothingAndWaitInfite();
How can one access the generic class .Instance without knowing the concrete Types ( ??? ) that have been used to make a new instance of the generic class?
I just like to access this shell class from everywhere in my app, any ideas?
myMsg.BehindDaKeys = "Chris Richner";
|
|
|
|
|
You can code this way:
ShellApplicationBase<SomeConcretClassType>.GetInstance().DoNothingAndWaitInfite();
or
ShellApplicationBase<SomeConcretClassType> myInstance = ShellApplicationBase<SomeConcretClassType>.GetInstance();
myInstance.DoNothingAndWaitInfite();
Note that GetInstance() has been changed from Property to a public static method. I'm not sure about if you can use Property before any instance is constructed.
-- modified at 12:43 Friday 8th September, 2006
Best,
Jun
|
|
|
|
|
Hi Jun Du,
One have to know the SomeConcretClassType to access the class type to get the Instance property. What happens now if the class instance was made by
new ShellApplicationBase<ConcreteClassA>();
but one access the singleton inside the application as
ShellApplicationBase<ConcreteClassB>.Instance.DoNothingAndWaitInfite();
as far as I could see this is not the same but it would work, right? There must be a way to retrieve this Instance property on this generic class without giving types to access just the class type, am I wrong?
myMsg.BehindDaKeys = "Chris Richner";
|
|
|
|
|
Chris Richner wrote: One have to know the SomeConcretClassType to access the class type to get the Instance property.
Yes, that is what you used generic class for. If you don't or needn't know SomeConcretClassType, why do you use a generic class?
Chris Richner wrote: What happens now if the class instance was made by
new ShellApplicationBase();
No, you can't call Singleton's contructor directly. It's protected. You have to get the instance via static call GetInstance().
Chris Richner wrote: There must be a way to retrieve this Instance property on this generic class without giving types to access just the class type, am I wrong?
Give a try, but I never thought we could call any method of a generic class without defining a "concret" class first.
Best,
Jun
|
|
|
|
|
public class Test<t> { public static int member; }
Test<int>.member = 2;
Test<string>.member = 3;
Console.WriteLine(Test<int>.member); // outputs 2
Every specialisation of Test<t> will have it's own static fields, so you always need a concrete type. If you just want one instance for all Test<t>, you have to create another non-generic class to hold the field and property.
|
|
|
|
|
Hi,
Thanks for your ansswers, don't get confused about the singelton pattern. I know that I didn't presented the whole code here that the singleton pattern would make sense and run.
It isn't that much about the singleton pattern, just about accessing a static field on a generic class. It seems to me that the big feature I really like about generics is going to make me some troubles accessing a single running instance of class within the application code.
Maybe this is just a indicator that the app design isn't that good yet.
Thanks any way
myMsg.BehindDaKeys = "Chris Richner";
|
|
|
|
|
Hello all,
I have created an application that scans web server logs for specific patterns of traffic. The scan works fantastic and considering the amount of logs it needs to scan, works fairly quickly.
The problem: I have created a status section on my Windows form that updates the status of what file is currently being scanned and what line it's on. As long that the window keeps the focus, the status area works great. If I move the focus to another window and return, the GUI doesn't refresh, but my app is still running correctly.
I have tried launching the scanning method into a new thread and that allows the GUI to refresh, but the application's performance is greatly effected.
Any thoughts on how I can refresh the GUI without multithreading the application? I can give more details if needed.
Thanks!!
SirChuy
|
|
|
|
|
You can occassionally myForm.Update() to force a redraw, but that won't keep the UI thread responsive, it will only force a repaint.
If you want to keep your UI truely responsive (accepting input, etc.), you've really got 2 options.
1. Use a a background thread to do the work. This really should not affect performance greatly as you say it does.
2. Listen for Application.Idle event, and do a little of the processing each time you receieve the event.
Either way, your app will slow down somewhat because now it's doing 2 things: responding to input while painting the UI, and is also processing the logs.
Option #1 is good if you need to do lots of background work that cannot necessarily be split up into smaller tasks. It has the benefit of leaving your UI thread completely dedicated to handling UI requests, but has the downside of introducing possible complexity with thread coordination.
Option #2 is good if you can split up your work into small, discreet tasks that can be run individually. It has the benefit of simpler overall software, since you're only dealing with 1 thread still, but it also has the downside of making the UI thread do some work, which can potentially make your UI look sluggish.
|
|
|
|
|
Thanks for the reply!
I tried the myForm.Update() but, as you mentioned, I still don't have a responsive form. Threading the method wasn't terribly slow but it was a noticable drop in performance. Since the log scanning I do will be in large batches, I'll go with the threading route.
Thanks for your thoughts!
|
|
|
|
|
Hi
How can i get only the file name from string who consist full path?
best regards
when i want to read something good just seat and type it
|
|
|
|
|
fullPath.Substring(fullPath.LastIndexOf('\\')+1)
Is the MSDN really so hard to read?
modified 12-Sep-18 21:01pm.
|
|
|
|