|
Hi guys,
I need some help, I am working on validation of the product and I was wondering if you guys could give me some suggestions on how to do it. Basically what I intend to do is to have 1 month, 6 months and 12 month product keys. I am having trouble especially figuring out how to monitor the time; what if the user changes time on their system? etc.
Please help
|
|
|
|
|
At this moment there is no hack free easy solution for this problem.
|
|
|
|
|
you can try one thing,
Store the Key, The Registratrion Date and the period in the database
and whenever u need to check the validity use the database servers current date instead of the local machine date.
I guess u dont change the database servers date.
Hope that works for u.
Regards,
Pramod
|
|
|
|
|
This response might work for the one who asked , but on a theoretical level their is a problem with this solutions. The problem is that you need the client to connect to the server all the time (or by the start of the application).
1 The client can block your app in the firewall.
2 And what if the app is installed on a labtop? One cannot block out users that don't have a connection to the internet 24/7.
|
|
|
|
|
You have a point,
my solution will work only for the applications that connect to the database.
Thanks & Regards,
Pramod
|
|
|
|
|
Internet activation always works but it is wrong. Machine based authentication can be done with encypryption and the registry Unf, windows doesn't allow self modifying executables. However, you could also use a generated resource file.
I like to cripple my apps in such a manner as to allow full access but make it difficult to use professionally.
For more expensive applications there is always the hardware key.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
One thing that I've seen products do is they will create a dll in the Windows/System32 library that is actually a binary serialization of the data they need. They do a nice job of also picking a name that looks important. You are still vulnerable if they are running a product that allows the user to stop an application from writing to disk. I've seen demo products running for months because they could not write their DLL to the hard drive.
|
|
|
|
|
What about using the licensing system that is built into .NET? There is a free open source version that ties into that and works pretty well. Open License[^]
It allows you to set a date range or number of days that a license is valid. The app would then fail on coming up and you could tell in the main function that it was a license issue and prompt the user to get a new one or whatever you want.
Steve Maier, MCSD MCAD MCTS
|
|
|
|
|
Hi guys/gals!
I have a little problem with creating a MSI package. I have added the custom "Customer Information" dialog to my installation process, but I don't know where this information is written to. I want to use this information for display on my "About" box and maybe later for online registration proposes.
Can anybody help?
Willem Le Roux
|
|
|
|
|
The information only exists in memory. You would have to write a custom installer action that gets the data passed to it, then the code would have to persist it.
|
|
|
|
|
Okay And now repeat in English please
Sorry mrCondor, but I have no idea what you are talking about... Yet. I played around with what I think your idea is, and it seems that I will have to write some other application (exe), DLL, script (js... preferably) or something like that to get the information and write it to the registry... somewhere... Perhaps?
Also, I toyed around in MS help and got some interesting goodies about Properties, USERNAME properties, COPANYNAME properties, UserSID properties, how all this gets written to the registry under the "InstallProperties" key and all sorts of tit-bits like that, but no example, no nothing.
Can anybody please steer me in a general direction? I have absolutly no idea where to start... Fooling a little feelish now! uhm he he he...
Willem Le Roux
|
|
|
|
|
Here is the code sample of sington class and their clients
<br />
public class single<br />
{<br />
public string str = "Hello";<br />
private static single s = null;<br />
<br />
private single()<br />
{<br />
}<br />
<br />
public static single CreateInstance()<br />
{<br />
if (s == null)<br />
s = new single();<br />
<br />
return s;<br />
}<br />
<br />
public string Get()<br />
{<br />
return str;<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
single i = single.CreateInstance();<br />
<br />
string str1 = i.Get();<br />
Console.WriteLine(str1);<br />
<br />
i.str = "World";<br />
<br />
i = null;<br />
single j = single.CreateInstance();<br />
<br />
string str2 = j.Get();<br />
Console.WriteLine(str2);<br />
<br />
j = single.CreateInstance();<br />
j.str = "New";<br />
string str3 = j.Get();<br />
Console.WriteLine(str3);<br />
<br />
<br />
}<br />
}<br />
Output::
Hello
World
New
But it should be
Hello
Hello
New
since we assigned i=null then the singleton must be destroyed and new instance should be created when j = single.CreateInstance(); executed right?
Thanks and Regards
Madhu
|
|
|
|
|
No, since i is a local variable. You're just nulling your local reference of the singleton (which continues to exist).
/ravi
|
|
|
|
|
madhusri wrote: since we assigned i=null then the singleton must be destroyed and new instance should be created when j = single.CreateInstance(); executed right?
No, that defeats the goal of the singleton pattern.
|
|
|
|
|
Hi leppie,
When i = null is assigned, there are no reference pointers pointing to the singleton object. Hence if there is a GC, then the singleton object has to be deleted. In this case, next time an instance to the singleton object is created, it should be a new object again. But the old object is being retained and returned when i call createInstance() again.
Basically, when will the singleton object be destroyed from memory?
We understand that an object will be deleted if there are no references to that object or if the object is set to null. Is this right?
Thanks and Regards
Madhu
|
|
|
|
|
When all object references are removed it is scheduled for garbage collection. The first round of the GC does the clean up. The next time the GC runs it removes it. If you need to free resources implement the IDisposable method and call that before assigning null and then just don't worry about it.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Event we tried to GC the i object after assigning to null ie.
i=null;
GC.Collect();
Thread.Sleep(2000);// Waitin for some time to Collect the object i by GC
even this never destroyed the object.
|
|
|
|
|
And if custom memory management is so important you shouldn't be using C#.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
madhusri wrote: When i = null is assigned, there are no reference pointers pointing to the singleton object.
This is incorrect. The class you showed has a static reference to its one and only instance.
madhusri wrote: But the old object is being retained and returned when i call createInstance() again.
And it manages this because something is holding a reference that the CreateInstance() method can pass back.
madhusri wrote: We understand that an object will be deleted if there are no references to that object or if the object is set to null. Is this right?
The first part is correct. The second part is incorrect because you are not setting the object to null, not now, not ever. What you are doing is setting a reference to the object to null.
|
|
|
|
|
Now we understand. Out situation is like One exe will invoke function in 2 separate dlls using reflection. first exe loaded the dlls. those dlls create log object using CreateInstance(). suppose if the dll1 assigned the
logobject.Moudulename="First";
logobject=null;<br />
GC.Collect();
then the exe unloaded this dll1 and try to access dll2 function which uses logobject instance, will the changes made by dll1 will be afected to dll2's Logobject? if yes means the logobjected is collected by GC right so it will be no longer available to dll2 rite?
|
|
|
|
|
I think you need to dispose the object out of memory.
Assigning null is no different then assigning a value. The object itself still exists.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
madhusri wrote: since we assigned i=null then the singleton must be destroyed and new instance should be created when j = single.CreateInstance(); executed right?
Nope, wrong!
See this code from CreateInstance:
if (s == null)
s = new single();
return s; What happens here is the one and only ever instance never to be repeated is created if it does not exist and stored in the static field called s. s is always returned. Nothing else ever assigns to s therefore the singleton pattern is maintained becuase you have ensured that there will only ever be one and only one ever instance of the object. This is the goal of the singleton, the behaviour you expect is at odds with the pattern you have chosen.
|
|
|
|
|
I want to set the font style to Bold when the user clicks Control + B key combination,
How do i do that?
Thanks & Regards,
Pramod
|
|
|
|
|
private void richTextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == Keys.B && e.Modifiers == Keys.Control)
{
this.richTextBox1.SelectionFont = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
}
}
|
|
|
|
|