|
I think you should respond to the OP rather than me. I think he'd prefer the information.
|
|
|
|
|
I’m studying computer programming, and I’m a little puzzled by the Composite design pattern.
In "Design Patterns in C#" by Steven John Metsker, Addison-Wesley, it says: COMPOSITE lets clients treat individual objects and compositions of objects uniformly.
And in "Programming C#", O'Reilly, it says about polymorphism: Thus, polymorphism refers to being able to use many forms of a type without regards to the details.
Is this not one and the same thing?
Programming is like Mathematics… you take ONE step at the time!
|
|
|
|
|
Polymorphism is one pillar of the OOP paradigm.
Composite is a design pattern, i.e. a very good solution to a well known problem.
I think you have to learn more about both OOP and design pattern techniques.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Polymorphism: being able to treat a car as an vehicle - using a base class reference to call virtual methods.
Composite: making a car of individual parts (motor etc.) and being able to treat both the motor and the whole car the same, e.g. calling Repair() on them.
The Composite pattern uses polymorphism (as most design patterns do), but it isn't the same thing.
|
|
|
|
|
Hi all!
i want to create a window just like window of solution explorer which can be "auto hide" if user wants to hide it. what such window is called? i mean what is its name and how to make it?
May God help u solv ur problems as well,thx in advance!!
shaz Jazz
|
|
|
|
|
I believe what you are looking for are autohide docking panes. The following link should bring you to a fairly good article on doing this. By doing a quick search on the site you can find many controls similar to this. http://www.codeproject.com/vb/net/DockPanelSkin.asp[^]
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[ ^]
|
|
|
|
|
Hi,
I want to place my visual component in Grid. In datagrid,its not possible to display any components...any suggestions on how to place it or any other grid which permit to display visual component?
Yes Im using .NET 1.1 framework. Hope you will reply
Shivaprasad
|
|
|
|
|
At the min im using c# and im not really too familiar with it, i have created a form with a piano on it in which all the keys are buttons and you press them and the internal beeper beeps, you can select your tempo and how long your note is and the duration of note or rest. This records all the info in a text file and then you put in the left hand, this places it into another text file. when you want to listn to the recording the files are mixed into one where all the notes that collide are seperated and sound as if they actually are two notes together because the console.beep function only allows one note at a time. I would really like to use midi or something to that affect that plays sound through either a sound card or just the speakers(through an internal sound board or whatever), ive looked at loads of c++ tutorials and vb ones too but there not much good to me because im not greate at importing dlls although im starting to understand it a bit.
Can anyone help me in any way, my email is bobjamin@aol.com. Its much appriciated.
!*!Tea!*!
|
|
|
|
|
You want to use DirectSound. Any examples in VB.NET will move to C# very easily.
Bobjamin wrote: because im not greate at importing dlls although im starting to understand it a bit.
It sounds to me like you'd do better to concentrate on core concepts before learning another library ( DirectX ). However, if that's what it takes to keep it fun for you, go for it. The DirectX SDK comes with plenty of samples in C# and VB.NET.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
In my .NET app, I instantiate a COM object from an installed application.
public static BobsPossesionsApp bob = null; // will later hold instance of BobsPossesionsApp
bob = new BobLib.BobsPossesionsApp();
IBobsHatsCollection hats = bob.Hats;
IHat firstHat = hats[0];
I was quite surprised to find that properties of firstHat could change in my application, if the Bobs Possessions application had changed them. In other words, the user is running Bobs Possesions, and my application creates an instance of the application and gets a Hat object from it. Back in the Bobs Possessions application, the user changes the color of Hat to red. And voila! - firstHat.Color changes from black to red in my application.
This surprised me, but I can live with. And I can even take advantage of it. However, if IBobsHatsCollection doesn't offer me any events to update me, how can I tell in my code when that Hat object has changed?
I would like an event to fire, that I can handle (as opposed to having to periodically poll the Hat.Color property). How can this be done? Can I get notification that a COM object has changed, if the COM server doesn't offer a notification interface?
I tried sticking the object in a Table, but none of the Table/Row/Column change notifications fired...
|
|
|
|
|
Hello World,
I'm trying to serialize a very basic object from a class I created in order to return it from a web service. However, the serialized object is always empty.
Can anybody help me with this please? Here's the short code and the response I get from the web service:
Thanks in advance!
<br />
[Serializable()]<br />
public class StatusCode : ISerializable<br />
{<br />
private bool _success = false;<br />
private string _statusCode;<br />
private string _statusMessage;<br />
<br />
public StatusCode() { }<br />
<br />
public StatusCode(bool success, string statusCode, string statusMessage) {<br />
_success = success;<br />
_statusCode = statusCode;<br />
_statusMessage = statusMessage;<br />
}<br />
<br />
public bool Success {<br />
get { return _success; }<br />
}<br />
<br />
public string statusCode<br />
{<br />
get { return _statusCode; }<br />
}<br />
<br />
public string statusMessage<br />
{<br />
get { return _statusMessage; }<br />
}<br />
<br />
public StatusCode(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
_success = (bool)info.GetValue("Success", typeof(bool));<br />
_statusCode = (String)info.GetValue("StatusCode", typeof(string));<br />
_statusMessage = (String)info.GetValue("StatusMessage", typeof(string));<br />
}<br />
<br />
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
info.AddValue("Success", _success);<br />
info.AddValue("StatusCode", _statusCode);<br />
info.AddValue("StatusMessage", _statusMessage);<br />
}<br />
<br />
}<br />
<br />
<?xml version="1.0" encoding="utf-8" ?> <br />
<StatusCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/" /><br />
|
|
|
|
|
Dear all,
I am researching in Augmented Reality. I wish to capture live video image and mount on it a 3D Computer Generated Image. I am using C#, kind of beginner so any help will be greatly appreciated.
Kindest regards ...
A.Khadragi
|
|
|
|
|
ahmedkhadragi wrote: I am using C#, kind of beginner
Then I am afraid you're dreaming. Write some more simple programs that lead up to this, which means you need to learn C#, DirectShow, and Direct3D, at least.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi
i want to protect my avi videos. my suggestion is encrypt it on hdd and play only with my Player, but how to do this ?
can Somebody any idea for solve this problem ?
thanks.
|
|
|
|
|
you've got two options. You can buy a commercial DRM system and loose all protection when one of the hhundreds of cracker groups eventually beat it. Or you can write your own, in which case one of the cracker groups will probabably find an easyly exploitable oversite in your code and crack it within weeks of it becoming popular enough to get any attention. Either way you loose, and once one person cracks the protection it'll be all over P2P. The only protection against this is to make your content suck so noone wants it in the first place.
If you write your own, use a standard codec interface. Unless you're google noone'll be interested in your new proprietary player.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Pretty cynical aren't we? Only it's true...
|
|
|
|
|
It's not cynicism if it's the plain and simple truth.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Easy. Don't create your video content in the first place! It's the only way to keep it secure.
What? You think I'm joking? I'm dead serious!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ok
but the best way is that encrypt it, and play it only with My Player(decrypt it and play as Stream)
but .. how to do ?
thanks
|
|
|
|
|
Do you think you're the first person to attempt this? Serisouly, you're going to spend alot of effort doing this, just so someone can crack it in, no joke, 1 hour.
You can encrpyt it all you want, but the problem is that you have to decrypt it to play it. There's the vulnerability right there. Media Player won't play from an .NET Framworkwork Stream object so you have to save the decrypted content to a file to play it. Boom, you just defeated your own copy protection.
Hypothetically, the only way around this is to implement your own Media Server in your application. This server would have to decrypt the file stored on the hard drive, then stream the decrypted content through the TCP/IP stack so Media Player can get at it.
Don't ask me for any code examples - like I said - the idea was off the cuff. I myself haven't done anything like that. It's just theory.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Hypothetically, the only way around this is to implement your own Media Server in your application. This server would have to decrypt the file stored on the hard drive, then stream the decrypted content through the TCP/IP stack so Media Player can get at it.
I'd say that you could get round that with a TCP/IP listener that just records the decrypted stream as it passes along and reconstructs a decrypted file from it.
Protection Broken.
DRM is a game of "Anything you can encrypt I can decrypt better"
|
|
|
|
|
Colin Angus Mackay wrote: DRM is a game of "Anything you can encrypt I can decrypt better"
Yes it is! Anyway, it was just a theory. I didn't put too much into the "thought problem".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hdv212 wrote: but the best way is that encrypt it, and play it only with My Player(decrypt it and play as Stream)
The problem is much more subtle than that. When you encrypt something you you need a key to encrypt it. The key is kept private so that no one else can access the information. The problem with DRM is that you must give the key to the person who you do not trust in order that they may play the video.
The problem is not the encryption/decryption process. That technology is very secure. The problem is key management. You don't trust the person that will receive the video not to copy it to everyone, yet they are permitted to view the video. If you can view the video, the stream can be decrypted. Once in a decrypted form you can do anything you like with it.
Digital Restriction Management technology is extremely flawed and large corportations with billions of dollars to throw at the development and research of the technology can't get it right so why do you think you can? even with our help - and there are some exceptionally clever people on this website.
|
|
|
|
|
Hi,
Is there any way to share an assembly between 2 applications with out using GAC
Thanks & Regards
Sabarish
|
|
|
|
|
Sure, if put them all in one directory.
|
|
|
|