|
I want to setup a remote singleton that keeps a sequence (and increments it). I get the last sequence number from a database and before the object is garbage collected i want to save the value back to the database.
Should/Can i implement this in the singleton's finalize method or is there someway to use ILease and when Sponsorship times out, then save to the database?
|
|
|
|
|
|
MarshalByRefObject doesnt derive from Componnet so doesnt have Dispose, and you need to derive a remoted object from MarshalByRefObject.
|
|
|
|
|
check out this site itself there is a singleton sample !!!
|
|
|
|
|
I know that. I am using it as a base for some work that i am doing. But i dont know when the remoted object is destroyed, so i wanted to know about Finalize, since MarshalByRefObject doesnt derive from Componnet so doesnt have Dispose.
|
|
|
|
|
Hi friends
As you know, within a class, we can refer to the current instance of class with 'this' keyword. Now suppose that I have 2 classes : ClassA & ClassB, is it possible to get the current instance of ClassA from within ClassB ? 
|
|
|
|
|
Having two classes is not the same as having two objects. The this keyword refers to the current instance defined by a class. So, from within the class definition of an object, one may retrieve a reference to and operate on itself using this . However, current instance has no meaning with regard to any other object (including other ClassBs) without some context: e. g. being passed or instanciating a reference to that other class. Consider: what does current instance mean if there are ten instances? Which one is current?
class ClassA
{
public Foo()
{ ... }
}
class ClassB
{
ClassB(ClassA classA)
{
classA.Foo ();
this.Bar ();
ClassB classB = new ClassB (classA);
classB.Bar ();
}
public Bar()
{ ... }
static Main()
{
ClassA cA1 = new ClassA ();
ClassA cA2 = new ClassA ();
...
ClassA cA10 = new ClassA ();
ClassB cB = new ClassB (cA1);
}
}
In Main() there are ten instances of ClassA (cA1 - cA10) and one of ClassB (cB). The only (non-static) objects that cB may operate on are
- itself
- ClassA instance cA1
- the internally created instance of ClassB: classB
I sure hope this helps.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
Thanks! your answer is complete and appreciated!
Regards
|
|
|
|
|
yes.
you pass the object of this class in ctor of another class.
that's it.
-Paresh
|
|
|
|
|
The free obfuscator with VS.net is the preemptive.com community edition. On the preemptive site it says it's only for acadamic and personal use.
So does that mean if you buy VS.Net 2003 and obfuscate your code with it, that you can't sell your app?
I'm looking for a url to some Microsoft legal that says there are no restrictions to the bundled version of the dotfuscator. If anyone wants to respond with just conjecture and guesses, no thanks, I need a url. I need legalese.
thanks in advance if you have a URL,
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
I would imagine you could find the text of the EULA for dotfuscator somewhere on the VS.NET 2003 CDs. That would tell you for sure what you are allowed to do.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
the dotfuscator shipped with 2003 is the "community edition" of the dotfuscator and
i would GUESS that the same rules apply if you get it from vs.net2003 or from their site.
also the community edition is not very good , it does merely change method/prop names , nothing else...
we use the full version which has workflow obfuscation , break ildasm , string encryption and shite , works lovely..
//Roger
|
|
|
|
|
Hi all
In my app i want to know when user tries to open any file.
i tried FileSystemWatcher but it raises events only when file is created , deleted , renamed.
is there anything like this that i can use to receive an event when user tries to open any file ..
may be any folder too.
thanks
plextoR
|
|
|
|
|
Hi all,
In my application i need to save a file (HashTable) using BinaryFormatters & i wanna load that file from another application.
The problem that when i try to load it from another app. it sayes " [app1 Name] or one off it's refrences are minssing"
how can i do such a thinG?
thanks all.
plextoR
plextoR
|
|
|
|
|
perhaps the object is not live in hashtable itself or its been disposed !!!
Paresh
|
|
|
|
|
i really dunno but i want to tell u that when i open the file using the same application that created it , it opens successfully but when i try to open it from other application it gives the error.
Do you think that saved files can be opened ONLY by the application that created it.
thanks for replaying
plextoR
plextoR
|
|
|
|
|
all of the labels and text boxes disappeared from my form. The underlying class is still intact(all labels and textboxes are declared).
Does anybody know how I can 'refresh' my form?
|
|
|
|
|
Hi,
Try checking more deeply into the InitializeComponent method, probably the editor deleted all initialization code.
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Thanks. It turns out that all of the calls to the 'AddRange' method of my containers (tabs, group boxes ect.) had been deleted.
|
|
|
|
|
In a winform using C#, I have a listview to which I've
added some items... I want to be able to detect a double
click event on an item that will tell me which item was
double clicked.
I've tried the double click event for the listview, but
it has no info about which item was clicked... I need
listview item event info.. can someone give me some
advice as to how this can be done...?
thanks.
|
|
|
|
|
vlusardi wrote:
can someone give me some
advice as to how this can be done...?
Use the ListView 's GetItemAt method to retrieve the item which was clicked.
You get the point that was clicked by using the static Control.MousePosition property, then pass that through the ListView 's PointToClient method (to convert from screen coordinates to ones relative to the listview).
f.e
ListViewItem lvi = myListView.GetItemAt(
myListView.PointToClient(Control.MousePosition)
); HTH,
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Set Activation property of ListView to 'Standard' and in 'ItemActivate Event' of ListView use the following code to get listview item info -
ListViewItem itms = listView.SelectedItems[0];
|
|
|
|
|
that's what I was looking for, thanks a lot.
|
|
|
|
|
string m_sSelect = "SELECT Firstname, Secondname, [House Name], [House No], Street, Area, Postcode FROM VOTERSREGISTER WHERE [Postcode] = 'DUBLIN 6W'";
int m_nCurrentRow = 0;
...
...
...
public bool Read(ref DataSet ds)
{
SqlDataAdapter m_sda = new SqlDataAdapter(m_sSelect, m_sqlcConn);
ds.Clear();
try
{
m_sda.Fill(ds, m_nCurrentRow, 100, "VotingRegister");
}
catch(ERROR BLA DI BLA....)
{
return false;
}
if(0 == ds.Tables["VotingRegister"].Rows.Count)
return false;
m_nCurrentRow += 100;
return true;
}
This is the my code.
Now my problem is that I am using a DataSet to hold the return data and I place that data in a Table called VotingRegister. I feel thats a bit of a waste. Is there anyway that just insert the data into a DataTable? Also see the way I pull in 100 rows at a time. Is it possible to do the same with .Fill() if you use a DataTable? As I'm expect over 5000 records to be returned if I didn't do it in steps.
help please!
|
|
|
|
|
zoltan_ie wrote:
I feel thats a bit of a waste.
It's a slight waste, but the bulk of the memory used is going to be in the DataTable so the small amount used by the DataSet isn't much when compared.
zoltan_ie wrote:
Is it possible to do the same with .Fill() if you use a DataTable?
Yes, the Fill method adds or updates records in the DataTable so existing records will still be there.
HTH,
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|