|
Thank you for the reponse, but it wasnt much help. I dont want to add, edit, delete, move, copy any of the information from the registry i just want to know if they have the program i stated in the question installed on their machine, as this means the download size of the program will be dropped by 20MB. If you have any other sugestions that dont involve using the registry i would be happy to listen.
Regards j1mb0jay (17YO programmer)
|
|
|
|
|
Yeh, I know it isn't much help...but the bottom line is that most system protection software will throw up alerts about your website if someone links to it and you try to even read the registry.
The typical deployment pattern that others have used is to setup download instructions as follows:
<br />
If you have never installed the software click here.<br />
<br />
If you already installed the software but want an update click here.<br />
I don't think you can avoid leaving it to the user to decide this. There are way too many sites that use such methods to start infesting worms or zombies on the unsuspecting.
Michael (55 yo developer)
-- modified at 13:07 Friday 9th June, 2006
|
|
|
|
|
Thank the Gods it's not possible!!! My God, can you imagine?!?
Visit BoneSoft.com
|
|
|
|
|
Hello i want to change the title(top left corner) programmatically. is there a way to do that?
Donkaiser
|
|
|
|
|
Form.Text property
"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." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Hello Donkaiser,
I assume that you mean the title of a Windows Form in your application. If you want to change the title of any Windows Forms, you simply change the "Text" property for that form, like this:
<code>
...
myForm.Text = "Some Title";
... So, if you are in your MainForm class, you would simply do this:
<code>
...
this.Text = "Some Title";
...
If that is not what you were asking, or you still need clarification, please reply with some more specific details and I will do my best to help you.
Sincerely,
Alexander Wiseman
|
|
|
|
|
Thank you that will work!
Donkaiser
|
|
|
|
|
These are the requirements:
Assembly ‘Shared’ defines class named ‘SharedClass’ .
SharedClass contains field named ‘Info’.
Assembly ‘Runtime’ defines class named ‘Manager’
‘Manager’ should be allowed to read and change field ‘Info’ on the instance of SharedClass.
Assembly ‘GUI’ defines class named ‘Client’.
‘Client’ can only read from field ‘Info’.
Can somebody help outline design that supports such requirements.
Thanks in advance,
Elina
|
|
|
|
|
I tried writing an answer for this, but there are still some missing pieces.
For example does Runtime own SharedClass or is SharedClass a static class that is visible to both Manager and Client? You did not say but imply that SharedClass is an instance class so someone must contain it.
Then there is the way it is accessed. If you have a containing class and expose a method to do the read/update, you can alway incorporate a Context class that each caller would implement. The context would help the setter in SharedClass determine if the update is allowed in the given Context.
One possibility:
SharedClass exposes GetInstance(Context context)
context is fed to the instance which is used to determine if the setter should be active.
Another possibility:
SharedClass is static and the access to info is exposed:
public static bool UpdateInfo( object info, ContextClass context )
context contains the AssemblyName of the caller.
|
|
|
|
|
You can use InternalsVisibleToAttribute to supply access to internal members of assembly A to members od asembly B.
[assembly:InternalsVisibleTo("Runtime")]
public class SharedClass
{
private string info;
public string Info
{
get
{
return info;
}
}
internal void SetInfo(string info)
{
this.info = info;
}
}
Manager defined by Runtime has access to SetInfo and calls it to modify info.
|
|
|
|
|
Sounds like Model View Controller (or "shared gui manager" if you will) pattern...
You'll have three projects
1. Shared project for model classes like SharedClass
2. Runtime project references Shared project so Manager has access to SharedClass
3. GUI project references Runtime and Shared project so Client can access SharedClass and Manager (though your requirments don't mention Manager access, it's part of MVC).
So your view and your controller can see and use your model, and your view can also use your controller to act on the model. I'll leave it to you to decide how to restrict Client's write access.
Visit BoneSoft.com
|
|
|
|
|
how to change system & system devices setting remotely with c#.NET with use of SNMP.
if any one have solution plz give it URGENTLY
Pradeep
-- modified at 10:33 Friday 9th June, 2006
|
|
|
|
|
Hello,
Recently I have been looking into threading in .NET, specifically in C#. I think I understand the necessity of using the Monitor class (or the lock statement as a shortcut) to assure that reading and writing operations on shared data are thread-safe.
I am confused, however, about using the lock keyword on static and non-static objects, especially when the variable whose thread-safety I want to assure is in a class. This is a rather vague question, so here is some code to clarify:
class MyClass
{
private readonly object locker;
private String strToProtect;
public String StringToProtect
{
get
{
lock(locker) { return strToProtect; }
}
set
{
lock(locker) { strToProtect = value; }
}
}
private int anotherPrivateObject;
public void ThreadFunction()
{
anotherPrivateObject = 0;
for(int i = 0; i < 10; i++)
{
anotherPrivateObject++;
System.Threading.Thread.Sleep(100);
System.Diagnostics.Trace(StringToProtect);
}
}
}
...
Main()
{
MyClass instanceObject = new MyClass();
instanceObject.StringToProtect = "set the string on this instance of MyClass";
Thread myThread = new Thread(new ThreadStart(instanceObject.ThreadFunction));
myThread.Start();
instanceObject.StringToProtect = "changing this string should not be a problem";
...
} Now my questions about this code are these:
1) Is this a proper way to lock an object inside a class and access it by multiple threads? (i.e. always going through StringToProtect 's public accessor?)
2) Should locker be static ? If so, why?
I think this question mainly arises from confusion about the static keyword - this confusion mainly arose from my recent investigation of threading, because many (if not all) of the examples I have seen use a static object to lock on.
Those two questions are the most important, but a third one occurs to me as well:
3) Is it wrong or bad-practice to have a thread function inside a class which is not a static function itself? Like, in my code example, the function MyClass.ThreadFunction . Is it a problem that this is not a static function and therefore can only be called when already possessing a created instance of MyClass ?
Thank you very much in advance for your time. If I have not stated the questions clearly enough, or the code sample is confusing, please let me know, I will try to rephrase or rewrite that part of the question.
Sincerely,
Alexander Wiseman
|
|
|
|
|
I don't see anything wrong with what you're doing. You use the property correctly by locking access to your field strToProtect . The lock object should be static if the field you're trying to lock is also static, but your field is an instance variable. And your thread function doesn't need to be static. It's not bad practice, it's just depends on what your requirements demand. As an instance method, that method will have access to the particular instance of MyClass .
If you want any of these things to be static, you should make them all static: the field, the lock object, and the thread method.
HTH
|
|
|
|
|
Dustin,
Thank you for the prompt response, that solves my difficulty!
Sincerely,
Alexander Wiseman
|
|
|
|
|
One thing you may want to consider is the affects of your lock on whether you have more writers than readers or the reverse for a normal environment. This[^] is an excellant article (but does not give you the code!) on various ways to perform your locks when dealing with many threads.
|
|
|
|
|
Thanks for the reference!
Among other snippets, I had been looking at this[^] excellent article, by Jon Skeet. Because of the way he does the code snippets, though, I got confused about locking on non-static objects (almost all his samples have static locking objects, though he does make reference to static vs. non-static in one place in the article). His Miscellanous Utility library[^] is also extremely useful (he provides a class that gives you the ability to have locks with timeouts).
Thanks again.
Sincerely,
Alexander Wiseman
|
|
|
|
|
how can i check if a textbox string contains numbers? and it returns true if it contains one or more.
Donkaiser
|
|
|
|
|
|
is that the right link?
Donkaiser
|
|
|
|
|
I misread your question. You'll need a regular expression. If you're only looking for integers, a regex like "[0-9]+" would be good enough. You can run that against a string and look at all the matches. Have a look here: http://msdn2.microsoft.com/en-us/library/hs600312.aspx[^]
|
|
|
|
|
If you're using .NET 2.0 use a TryParse method, such as Int32.TryParse, to see if a string contains a number. If you're using .NET 1.x, then call Int32.Parse or Convert.ToInt32 - but be sure to wrap that call in a try/catch block because if the conversion fails, an exception will be thrown.
Checking if a string contains multiple numbers, like "12 43 656 234523 24", you can use the Split method of the String class to break the input into an array of strings. Then call Parse or TryParse on each string in the array. Beware that calling Split has subtle issues if the input value has multiple spaces in a row. You might want to remove extra spaces, or some other precautionary measure, before parsing the text into numbers.
josh
|
|
|
|
|
will that work if my string is sth like "abc12def"? the check function should return true if it found a number inside a string.
Donkaiser
|
|
|
|
|
No. You can use a regular expression, or loop over each character in the string and use Char.IsNumeric() to check if each char is a number.
Josh
|
|
|
|
|
hi
i could add exe file to my vstudio solution and set build action to Embedded Resource and by working with resources i could take it to stream .
i want to run my exe .. how to that ??
My code is ::
string fullName = this.GetResourceFullName("HDCopy.exe");//i want to run this exe
Stream stream = this.asm.GetManifestResourceStream(fullName);//load my exe to memory
//How to Run My exe from Memory (Stream) ??
private string GetResourceFullName(string resName)
{
string fullName = null;
foreach (string str in this.asm.GetManifestResourceNames())
{
if (str.EndsWith(resName))
{
fullName = str;
break;
}
}
return fullName;
}
HDCopy.exe is not dot net .
|
|
|
|