|
Hey guys!
I have a question and I think the answer is 'Remoting', but I want to know for sure. I want to write an application which contains modules. Customers buy the 'base' software. If required, they buy additional modules which enables the software to 'do more'. Now all these modules are seperate projects (and thus seperate dll's). I want the software to check if a module is 'active', and then check for the existance of the dll, if both are OK, the system can reference the dll and use it.
Ofcource all modules are available at design time so referencing the dll's is no problem, but when starting the system with one or more dll's missing i'll receive a JIT Debugger message. Is there a way to not deliver all modules, but only deliver the 'active' modules and change that (change db values and copy the module dll's) without having to compile the software again?
And... Can I also accomplish this without module versioning? What I mean here, is that I may want to change (update or fix) modules which result in a new module dll (and a new version). Can I still use that dll from the 'base' system without having to decompile? (I am aware here, that I need to be very carefull what to change and not change (for example) return value types or so).
Hrmmm... a fairly large story, but I wanted to explain exactly what I want to get a satisfying answer. Since English is a foreign language for me I may have used some unneeded words Cheers guys!
|
|
|
|
|
|
hi,
i have a multithreaded application in which i m downloading files and updating GUI.it runs fine when i debug it but dnt update the GUI when i run it in release mode.tell me where i m wrong?
|
|
|
|
|
Member 590310 wrote: tell me where i m wrong?
By giving us a vague description with no code to review. That's where you are wrong.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You've asked this very same question before and I asked you to tell us more about the problems you were having and to post some code. But you ignored my (and Luc's) reply and now you just post it again. This day didn't start very well, and you just made it worse...
|
|
|
|
|
private void LoadKeywordsCombo()
{
using (var db = new momdbDataContext())
{
keywordsComboBox.DataSource = db.Books.Select(c=> c.Keywords !=null
c=>new{ID=c.ID,Name=c.keywords});
keywordsComboBox.DisplayMember = "Name";
keywordsComboBox.ValueMember = "ID";
}
}
I'm wanting to somehow select everything from the book table where keywords is !=null and populate my combo box accordingly. i thought it might be the .where() method but i'm not sure
thanks in advance for the help
|
|
|
|
|
Are you sure Keywords is null and not an empty string? Best use the IsNullOrEmpty method.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
could you give an example of how i might use the isnullorempty in this instance ?
what i'm trying to avoid is a combobox witha bunch of blank fields where the keyword isn't added
|
|
|
|
|
Read the documentation, Select take a predicate that returns a bool. string.IsNullOrEmpty returns a bool. Ergo...
keywordsComboBox.DataSource = db.Books.Select(c=> !string.IsNullOrEmpty(c.Keywords))
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello all, my name is Sundeepan and I am new to this board and to coding as well. To train myself and get familiar with OOP concepts using the C# language I am reading, "Microsoft .NET Framework - Application Development Foundation" book by Tony Northrup. I am finding this book very informative. I do have a question that I was not able to find an answer to by querying Google. The question is as follows:
If a method requires an object as one of its parameters why should one not pass an object of a base class, instead one must pass an object of the derived class?
I understand that this might be a foolish question, but I am at a very early stage of my learning, any help would be appreciated. Metaphors are equally as helpful as a technical answer.
Regards
Sundeepan
http://sundeepinthought.blogspot.com
modified on Friday, February 5, 2010 12:32 AM
|
|
|
|
|
class Animal
{
protected void Foo(){}
}
class Cow : Animal
{
public vod Moo(){}
}
class Farm
{
public void Pet(Animal animal){}
}
If you pass Animal to a method then you can only access the Foo method. However, if you pass Cow, you will have access to both Moo and Foo methods since Cow derives from Animal.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
So if I wrote
class Farm
{
public void Pet(Cow chicken){}
}
I can access both Foo and Moo?
But if I wrote
class Farm
{
public void Pet(Animal man){}
}
then I can only access the Foo method?
Lol..nice example though....clarification is needed if you don't mind
|
|
|
|
|
sundeepan wrote: Cow chicken
and
sundeepan wrote: Animal man
was a really comical. Anyway i don't see any clarification to make since it is just as you say. When you inherit, you get the members you inherit and in addition any member you make in the new class. Just like if someone left you some items to travel to an unknown land ( ) then, you'd have the items you originally owned plus the ones he left you. But he would not have the items you own since you never gave it to them.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
sundeepan wrote: why should one not pass an object of a base class
Who says you shouldn't? There are many cases where you would.
|
|
|
|
|
This is the paragraph that threw me off:
"Another benefit of inheritance is the ability to use derived classes interchangeably, a concept called polymorphism. For example, there are five classes that inherit from the System.Drawing.Brush base class: HatchBrush, LinearGradientBrush, PathGradientBrush, SolidBrush, and TextureBrush. The Graphics.DrawRectangle method requires a Brush object as one of its parameters however, you never pass an object of the base Brush class to Graphics.DrawRectangle. Instead you pass an object of one of the derived classes. Because they are each derived from the Brush class, the graphics.DrawRectangle method can accept any of them. Similarly if you were to create a custom class derived from the Brush class, you could also pass an object of that class to Graphics.DrawRectangle. "
|
|
|
|
|
It sounds like the author isn't a very good technical writer. Which is one of my complaints about mass-market programming books. And one of the benefits of taking a class with a real live teacher -- you can ask the teacher for clarification.
That may not be a good example -- System.Drawing.Brush is abstract, so you can't have an instance of it anyway. But if you do have an instance of it, then you could go right ahead and pass it (but who knows what would happen).
|
|
|
|
|
Its a "Microsoft Press" book for the 70-536 cert exam...this guy better be a good technical writer lol!
|
|
|
|
|
I actually almost say the contrary is true.
Mark Nischalke's answer holds true, you do have access to both the Moo() and Foo() methods by passing the subclass. However to do so couples the method to the subclass, and other instances of the animal class cannot be passed:
class Program
{
static void MakeAnimalSpeak(Animal animal)
{
animal.MakeNoise();
}
static void MakeAnimalSpeakCoupled(Cow animal)
{
animal.MakeNoise();
}
static void Milk(Cow animal)
{
animal.Milk();
animal.MakeNoise();
}
static void Main(string[] args)
{
Cow cow = new Cow();
Duck duck = new Duck();
MakeAnimalSpeak(cow);
MakeAnimalSpeak(duck);
MakeAnimalSpeakCoupled(cow);
Milk(cow);
}
}
abstract class Animal
{
public abstract void MakeNoise();
}
class Cow : Animal
{
public override void MakeNoise() { Console.WriteLine("Moo"); }
public void Milk() { Console.Write("Sloooosh"); }
}
class Duck : Animal
{
public override void MakeNoise() { Console.WriteLine("Quack"); }
}
Of course it is horses for courses, as with everythign in the code world. In the example Mark gave, you should pass the cow if you need access to both Moo() and Foo() but otherwise IMO is is better to pass an Animal instead. Better yet, coding to Intefraces produces cleaner results still, and helps with testing (as mock objects can be passed more easily)
Cpianism: I have a negative number in my Rep so please fix it.
Chris Maunder: That isn't a bug.
|
|
|
|
|
This is great, I like the humor involved too. I am saving this reply as a PDF on my computer.
Thanks again!
|
|
|
|
|
Hi,
I had a question regarding the Windows Aero Glass Feature, found in Windows API Code Pack. This feature is not included in Windows XP and Vista, I believe. So if the GlassForm is shown in Windows XP, will an error be thrown? or will the GlassForm window be shown, without the aero feature and without anyerror error?
To be more clear: What will happen if the GlassForm is show in Windows XP/Windows Vista?
Thanks,
Harsimran Singh
|
|
|
|
|
WPF also allows aero to be forced on an app, but when you do that, the appropriate DLL is already in the GAC on the user's machine (because they're running the appropriate version of .Net. I suspect that if you include a CodePack assembly in your references, the appropriate DLL will get copied to your bin folder.
Try it and see...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Even if I try that, I can't test it. I don't own a XP or a Vista machine. I only have Windows 7.
For more information, you should check out my article: Windows 7 FTP Application
It only runs on Windows 7, because of the Windows 7-specific features. I can control other windows 7-specific features on Windows XP/Vista using if(CoreHelpers.RunningOnWin7), however, some of my forms use the glass form. which I can't really control using CoreHelpers.RunningOnWin7, because a Form inherits from GlassForm to use the GlassForm feature.
First question would be: What happens if GlassForm is shown in Windows XP? Will an error be thrown? It doesn't matter if the aero feature is not shown, since it is Windows XP/Vista. I only require the glass feature in Windows 7.
I hope I am clear,
Thanks,
Harsimran Singh
|
|
|
|
|
Pathachiever wrote: It only runs on Windows 7, because of the Windows 7-specific features.
If it only runs on Windows 7, then why are you asking about XP? If you don't want it to to run on XP, then do a Windows version check before you display the first form, and terminate the program if it's running on XP.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Sorry. I knew I wasn't clear on my side.
Actually, I want the application to run on Windows XP. However, I don't know what will happen if the application is ran on Windows XP, since Windows XP probably does not support the glass form feature.
I hope I am more clear now. I just need to know what will happen when the Glass Form is shown in Windows XP.
Thanks,
Harsimran Singh
|
|
|
|
|
Then run it on XP (in a VM if necessary) and see what happens. If you're not doing anything to actually skin the forms, it should fall back to whatever the host OS is capable of..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|