|
Snowjim wrote:
It is coded by hand and we are only using our own code, or what do you mean?
I meant, are you starting a new ASP site ( if so, I can't imagine why ), or have you inherited one.
Snowjim wrote:
it would take to much time to tech us ASP.net right no.
You obviously know C#, I don't see where the problem lies. The worst you could do is write an ASP.NET site that could be improved upon later.
Snowjim wrote:
COM sounds intressting, i will have to searth some sites for COM with ASP and C#.
You don't spin up COM objects now in your ASP project ? How do you handle the middle tier development ?
Snowjim wrote:
but it dont simes right to use.
No, it would be plain terrible
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I meant, are you starting a new ASP site ( if so, I can't imagine why ), or have you inherited one.
We are building a Forum with ASP(not about ASP), to this forum we are building a Server/Client.
This Server/Client program will offer notification when someone is applaying to i thread that the user have subscibed to or somthing like that. The server will get the info that the client requests form the ASP Forum page(or how we now whould have to sulve the problem).
This way users will get posibility to answare on threads and PM with out going to the FORUM page.
This project is a School project
We dont use COM and have never done, but it would be intressting to learn, if its the way to go(only way maby? besides the ugly one)
Best Regards
SnowJim
|
|
|
|
|
Snowjim wrote:
We are building a Forum with ASP(not about ASP), to this forum we are building a Server/Client.
OK - well, I strongly recommend you don't do this, but use ASP.NET instead.
Reasons - first and foremost, asp sucks. Secondly, you're learning or know C# already, and COM means C++. You cannot do a meaningful ASP site without a middle tier, which means you need to write a COM component. This is a hell of a pain if you don't already know COM and C++.
Snowjim wrote:
We dont use COM and have never done, but it would be intressting to learn, if its the way to go(only way maby? besides the ugly one)
COM is required to do anything half decent in ASP, assuming you want to do it properly. ASP.NET is definately the way to go here. Who suggested asp, your teacher ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
We can C++ good, and if there is no other way we will have to make the COM component one way or the other.
Ther ASP forum is on good way to finish as well ass the Server/Client.
Yes we was about to gå with ASP.NET but our teacher dident agree, it was harder for him to check our project.
He also whanted us to use Access insted of SQL becourse its easyer for him to check.
//SnowJim
|
|
|
|
|
OK, so your core problem is that your teacher is a moron. I suggest finding another course, or at least not putting too much faith in this one.
The only decent way to do ASP development is to put the business logic in a C++/COM component and then call it from the asp, that way you can limit the ugly VBscript code to next to nothingness. There are plenty of articles around on COM development, but it's a bit of a mind melt at first, at least it was for me.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Okay, i understand.
Thanks alot for all help, maby we do the ugly way after al, if we not are going to use this forum for real anyway.
And build a forum in ASP.net later on.
Best Regards
Snowjim
|
|
|
|
|
I've got to agree with Christian. This is a really bizare way to design an application.
Another option for getting the ASP application to comunicate with the server is through a WebService interface rather then a COM interface. That way you would at least learn something about ASP.Net and use something that in it's early stages of adoption, rather then on it's last legs like COM.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Okay! thanks alot, we will look in to Webservices, wh have thougt of that before but we dident know that is suported ASP to.
//SnowJim
|
|
|
|
|
|
Hello!~I am a newcomer. Currently, I am doing a project which requires to change some java code to C#. But the java code import the java_cup.runtime.* library, is there any C# parser that has the same function?
I am now using the C# cup from http://www.infosys.tuwien.ac.at/cuplex/cup.htm[^]
, but there are some errors. Can anyone help? Thx a lot!!~
|
|
|
|
|
the subject says it all, how do I create an event handler for when a the active tab in the tab control is changed?
|
|
|
|
|
Select your TabControl in the Form Designer, go to the properties window, select the events view by clicking on the yellow bolt and finally double click on the entry TabIndexChanged.
Visual Studio will then create the following code for you. Of course you can code this by yourself too.
this.tabControl1.TabIndexChanged += new EventHandler(tabControl1_TabIndexChanged);
private void tabControl1_TabIndexChanged(object sender, EventArgs e)
{
}
www.troschuetz.de
|
|
|
|
|
In the documentation on this method it says i can extract the read data within the callback method? i dont understand how to do this...
eg
NetworkStream str = (NetworkStream) result.AsyncState;
byte[] myReadBuffer = new byte[2048];
int numberOfBytesRead = 0;
numberOfBytesRead = str.EndRead(result);
it says "To obtain the received data, call the AsyncState method of the IAsyncResult, and extract the buffer contained in the resulting state object"
so in my case the IAsyncResult = result and I case the stream state from it but how do i get the data? as theres no method to call??
confused
mike
|
|
|
|
|
Create a object which looks something like this
class ObjectState
{
public byte[] myReadBuffer = new byte[2048];
public NetworkStream str = set the network stream object u had created
}
now when you call beginread call it this way
ObjectState state = new ObjectState();
networkstream.BeginRead(state.myReadBuffer, 0, 2048, AsyncCallback method pointer, state)
//Pass state object to last parameter of BeginRead.
when u endread
ObjectState state;
state = (objectState) result.AsyncState;
int numberOfBytesRead = 0;
numberOfBytesRead = str.EndRead(result);
now use state.myReadBuffer; //This should contain the data u r looking for
|
|
|
|
|
Say I have this:
class Boo
{
private int x;
private Foo f;
public Boo()
{
x = 0;
Foo = null;
}
}
Can I use the Wizard to inplement the constructor? Keeps telling me NO. -thanks...
|
|
|
|
|
Well, in those particular cases, they will be initialized to 0 and null by default.
Matt Gerrans
|
|
|
|
|
Say I have this:
class Boo
{
private int x;
private Foo f;
public Boo()
{
x = 0;
Foo = null;
}
}
Can I use the Wizard to inplement the constructor? Keeps telling me NO. -thanks...
|
|
|
|
|
|
So it's answered your question, but you feel the need to ask here ?
What wizard ? You've implimented a constructor as far as I can see, what do you mean ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hey
I'm doing a little C# exercise and it involves overriding an inherited method
Here is my code
using System;<br />
<br />
namespace BookOverride<br />
{<br />
class Book<br />
{<br />
public string Title()<br />
{<br />
return "Damn Good Book";<br />
}<br />
public string Rating()<br />
{<br />
return "5 Stars";<br />
}<br />
}<br />
<br />
class OtherBook : Book<br />
{<br />
public string Title()<br />
{<br />
return "Some Other Damn Good Book";<br />
}<br />
}<br />
<br />
class Class1<br />
{<br />
static void Main(string[] args)<br />
{<br />
Book bc = new Book();<br />
Console.WriteLine(bc.Title());<br />
Console.WriteLine(bc.Rating());<br />
<br />
OtherBook ob = new OtherBook();<br />
Console.WriteLine(ob.Title());<br />
Console.WriteLine(ob.Rating());<br />
}<br />
}<br />
<br />
}
Now the funny thing is that my VS .NET tells me that new is required when creating the method in class OtherBook, but the whole thing works without it? I do get a warning though
warning CS0108: The keyword new is required on 'Polymorphism.B.Foo()' because it hides inherited member 'Polymorphism.A.Foo()'
Anybody knows why it issues a warning instead of an error?
I am gonna use the new keyword from now on. It's nice to see which methods that get overridden, but does it have a valid purpose other than that?
/thallish
---Sometimes it's the smallest of things that make the biggest of systems crash.... Hey get away from that switch!!!
|
|
|
|
|
hi again
I found my answer.
It turns out that only if a method is declared virtual, derived classes can override this method if they are explicitly declared to override the virtual base class method with the override keyword.
/thallish
---Sometimes it's the smallest of things that make the biggest of systems crash.... Hey get away from that switch!!!
|
|
|
|
|
was your question than??
However I think my note about override vs new applies to it :P
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
hi,
"If you remove the new modifier, the program will still compile and run, but you will get the warning"(MSDN)[^]
"A class-member-declaration is permitted to declare a member with the same name or signature as an inherited
member. When this occurs, the derived class member is said to hide the base class member. Hiding an inherited
member is not considered an error, but it does cause the compiler to issue a warning. To suppress the warning,
the declaration of the derived class member can include a new modifier to indicate that the derived member is
intended to hide the base member" (ECMA C# Spec[^])
What above quotations say, IMHO means new identifier is meant to mark members/classes you intentionaly hide, while when you don't mark 'em it can be because you forget about base members with same names... So it's more like auxilliary keyword - bt useful.
thallish wrote:
PS: I am gonna use the new keyword from now on. It's nice to see which methods that get overridden, and it must have a valid purpose other than that.
exactly!
What is also meaningful difference between new and override is that overriden provides specialization of base method - provides new implementation, while new method's purpose can be different - methods just happend to have same name.
Well, I may not be 100% acurate, bt hopefully my answer is not useless
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
The other important thing to note is that new allows you to access the base class member through your object via a cast to the base class.
override , on the other hand, will force .NET to execute your specific implementation (ie, overriding all base implementations) regardless of whether you cast the object to it's base class or not. Since this keyword is relatively powerful you are required to mark the base methods as virtual or abstract to ensure that behaviour is desired.
At least, I'm fairly sure that's correct. new and override have confused me for a while, and I think I nutted out the difference, finally :p
This space for rent!
My Blog
|
|
|
|
|
The use of the keyword new indicates that you are "hiding" or "shadowing" the base implementation of the method, and that is generally not a good idea.
If you are responsible for the base implementation as well as the inheriting implementation, the best thing to do (unless your situation absolutely precludes it) is to make the base implementation virtual and use override in your subclass(es).
If you do not control the base implementation, using new , or failing to use override on the inheriting method implementation indicates to the compiler that you are completely replacing the base implementation which can be a dangerous choice if you do not fully understand what the base implementation is doing. In fact, hiding base class members is a risky undertaking in any case given that this practice obscures the behavior of your class instances (objects).
A major source of confusion when hiding/shadowing methods can appear when you're declaring variables at design time. If, for instance, your implementation of Class1 required you to treat all types of books as Book instances (e.g. if you had many possible types of book and did not know which specific type you might be operating on - a very common scenario, and one of the biggest values of polymorphism), then you might want to declare all book-type variables as Book. This solution works beautifully if you are using inheritance with virtual and overridden versions of the Title property; the instance version of each overridden member is called without the client ever having to know which type it's using.
However, using new will get you into trouble. If you have hidden a base implementation, then declare a variable as the base type, at run time the framework has no choice but to use the base implementation instead of the subclass implementation. From your example:
class Class1
{
static void Main(string[] args)
{
Book bc = new Book();
// The following will return "Damn Good Book"
Console.WriteLine(bc.Title());
Console.WriteLine(bc.Rating());
// Changed to make the book instance more general
Book ob = new OtherBook();
// The following will return "Damn Good Book" instead of the expected
// "Some Other Damn Good Book", even though, when inspected, your
// instance "ob" will indicate that it is of type "OtherBook".
Console.WriteLine(ob.Title());
Console.WriteLine(ob.Rating());
}
}
The long and short? Use virtual and override modifiers wherever it is possible, and use new only as a last resort.
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|