|
|
Verghese wrote: database table has dates splitted in 4 columns like DD, MM, CC, YY
Which is a very poor design.
Verghese wrote: database doesnt have anything like a date field
What database doesn't have a DateTime type?
|
|
|
|
|
Dear........this is not my design, its the way how dates are always stored in AS400 Mainframe systems. I'm working on IBM iSeries Mainframe server. I have not much options on choosing the database.
Did I cleared your doubt???
|
|
|
|
|
Had you said that first, you would have gotten more sympathy.
|
|
|
|
|
dear friend, i didnt knew u were this caring...........but dont be in the assumption that it was way too funny...........
|
|
|
|
|
See example :
DateTime d = new DateTime(2008, 8, 29, 12, 0, 0);
Console.WriteLine(d.ToString("dd-MM-yy"));
|
|
|
|
|
Hi,
In crystal report I want to display data of a field of my DB in 5 columns of details view, (instead of 1).
How can I do this?
suppose I want to show names of customers, but they display in 5 columns, not they apper in one columns.
Best wishes
|
|
|
|
|
Hi,
You add a table from the toolbox to the report and define 5 columns.
Mika
|
|
|
|
|
OK - I have created a static class to add a "heartbeat" to an application (in a similar way to the way Trace and Debug classes work) thus:-
public static class Heartbeat
{
private static HeartbeatListenerCollection _listeners = new HeartbeatListenerCollection();
public static void Beat()
{
foreach (HeartbeatMonitorBase _listener in Listeners)
{
_listener.Beat();
}
}
static Heartbeat()
{
TimerCallback timerDelegate =
new TimerCallback(Heartbeat.Beat);
AutoResetEvent autoEvent = new AutoResetEvent(false);
System.Threading.Timer heartbeatTimer =
new System.Threading.Timer(timerDelegate, autoEvent, 0,1000);
}
public static HeartbeatListenerCollection Listeners
{
get { return Heartbeat._listeners; }
}
}
}
However this only gets started beating the first time the class is referred to. Does anybody have any thoughts as to how I could get this class to instantiate at startup?
|
|
|
|
|
I'd use the singleton pattern and create the heartbeat like this:
class Heartbeat
{
static readonly Heartbeat instance = new Heartbeat();
static Heartbeat()
{
}
Heartbeat()
{
}
public static Heartbeat Instance
{
get
{
return instance;
}
}
}
and init it:
Heartbeat h = Heartbeat.Instance;
anywhere in your startup code.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
It's good - but to make things even trickier, I want to be able to instantiate the heartbeat for an application even if that application code doesn't have any reference at all to the class.
|
|
|
|
|
Why do you want this? The only thing I can imagine is to put the heartbeat class into a separate DLL and then initialize the heartbeat class using reflection, something like:
Assembly heartbeat = Assembly.LoadFile("heartbeat.dll");
string fullname = heartbeat.GetTypes()[0].FullName;
Object obj = heartbeat.CreateInstance(fullname);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Can you modify the start sequence so that your application is started first, it inits the Heartbeat-class and then starts the actual application?
Mika
|
|
|
|
|
Duncan Edwards Jones wrote: even if that application code doesn't have any reference at all to the class
Then it won't get loaded.
Try adding a field to the class that contains the Main.
|
|
|
|
|
It will get loaded if the application .config references the class - this is how Trace Listeners get added / removed without recompiling.
|
|
|
|
|
I don't use those and I don't know what they're good for.
But now I'm wondering what the heartbeat the OP is talking about does.
I'll have to go reread the post.
|
|
|
|
|
A) I expect the class doesn't need to be instantiated until a listener is attached.
B) Is it using events? If not, why not?
C) What's it supposed to do? It seems like all it does is let the listeners know that the class is in memory, not that it's actually doing anything. I prefer my Windows Service code's "heartbeats" to be generated within the service loop itself, so I know the actual code is progressing.
There are times when a Service gets "hung up", at those times I don't want some other thread telling me that everything is going just fine.
Also, the "heartbeats" I use are merely updates to a database, so any system on the network can check the status of all my Services on all the servers. Plus the advantage that a successful "heartbeat" means that the Service can write to the database, which is an important test.
I expect all you really need is an event that you raise at different points in your code.
|
|
|
|
|
In my property grid I have a couple of properties that have an expand ("+") indicators next to them. When I click on them the indicators disappear. These properties don't have any sub-properties to display so I'm not sure why the expand indicator is even drawn. If I change a property in the propertygrid and it is re-drawn the indicators come back.
Any ideas? Functionally it isn't a problem, it's just ugly.
|
|
|
|
|
For that particular property, is its return value an object that has properties of its own? The problem may be occuring because the property has subproperties but the IDE does not know how to design them. This would mean the '+' would go away.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Yes they are objects that have properties of their own, with BrowsableAttribute set to false. Do you see a workaround for this?
Edit: I stand corrected. I just built a small test case with the return property having NO sub-properties and the phantom expand mark still showed up.
modified on Thursday, July 31, 2008 12:49 PM
|
|
|
|
|
I can't think of anything off of the top of my head that would prevent that attribute from working . The only thing that might be able to help is an article I wrote on design-time events[^], but even then it doesn't have the specifics of what you are looking for.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
I figured it out.
I was being a dummy.
My type converter class(es) where of base type ExpandableObjectConverter when they should have been TypeConverter.
|
|
|
|
|
Peer pressure from this group has forced me to implement IDisposable on my class.
My reading of the Dispose() documentation tells me that I should:
1. call Dispose() from my destructor
2. keep a private field (this.disposed ), and set it at the end of my Dispose() method
3. "test this.disposed in all of your class' regular methods, and throw an exception if the object is already disposed." (emphasis mine)
Does this mean I also need to test this.disposed in the get/set clauses of my properties?
Or just in my "regular methods"?
|
|
|
|
|
It's kind of an extra check. The world isn't going to end if you don't do the check, but it might add an extra bit of insurance that things aren't going wrong.
You should never access a disposed object, it can cause all kinds of problems. The check is only there to ensure that you don't. Personally, I do the check in _public_ methods, but tend not to bother in properties. Although technically you probably should.
I'd be interested in other people's opinions on this though.
Simon
|
|
|
|
|
And then what do you do if the instance has been Disposed?
"
The primary use of this interface is to release unmanaged resources.
"
When a class doesn't directly use unmanaged resources or a resource that implements IDisposable, then I generally don't implement IDisposable on it. However, implementing IDisposble allows for the class' use in a using statement which is a very handy technique, so in some cases I may implement a Dispose method that does nothing or otherwise leaves the instance in a usable state.
So I don't bother with tracking whether or not Dispose has been called on the instance.
If Dispose has released some resource, then generally the instance's reference will be null and I can check that and either make a new instance or throw an Exception, as appropriate.
|
|
|
|