|
*grin* I felt I'd gone too far after I posted it, but I was pretty mad at the time.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian, I wasn't talking directly to you. I was talking to the people who make comments like the ones in your signature. I've never said anything about it before, but I really get disgusted at the attitude such people have. It usually goes beyond just VB and gets personal. I've seen too many new programmers who start out in VB get slammed by people like Alex E. "every ill-educated moron became able to develop software". So no, I wasn't talking to you specifically, I never even said your name. But that comment in your sig really pissed me off. Sorry for the offense.
|
|
|
|
|
Jon Rista wrote:
Christian, I wasn't talking directly to you.
Oh. Um. *blush*.....
Jon Rista wrote:
Sorry for the offense.
I've already said that I thought I went too far in my reply, but I should say so to you directly. I had had a hell of a day yesterday, and to come home and feel that someone was ripping in to me was a little much. I'm sorry to have gone off to such a degree as well.
I think a lot of the VB comments made on this site are made half tongue in cheek, knowing that people are going to quote them and laugh about them. I *know* that VBers make similar comments about C++ programmers being precious about their language, and good luck to them ( they have so little, after all ). It's good to remember that when you see someone quoted in a sig, you're getting what they said out of all context as well.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian, I really must apologize. I had a pretty crappy day yesterday as well (and am currently jobless), and snapped when I saw Alex E.'s comment in your sig. I did not consider that you may have had a hellish day too, and I am truely sorry.
The root of it comes from a few times when I've seen (i.e. in chats, forums, etc.) truely enthusiastic people starting out in VB get slammed by C++ programmers, after which I never saw them again. I find it sad that people will attack someone new to programming simply because they chose to start using VB. When I started programming, people suggested I use C rather than Pascal, but no one ever ripped into me. I was helped, taught, and I learned. After a little over a year I moved to C++. Today, if you don't start out in C++, your shunned, belittled, and laughed at. That gets to me.
|
|
|
|
|
To be honest, I agree with you 100% that if people are using ANY language, and having fun, then good for them. I'm sorry to think that people would attack someone who is trying to learn, although I would certainly try to steer someone towards C++, or at least make them understand the limitations of VB, it's sad to think that people may give up altogether because someone decides to rip into them.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Jon Rista wrote:
As for the comments about VB. I get really sick of hearing those. I've programmed for 17 years.
Wow! 17 years! According to your profile your were born in '79. I'm Impressed coding since your were 6. WOW! Was Pascal out in 85?
|
|
|
|
|
Yes, I was born in 1979. And yes, pascal was out long befor I was born. And yes, I was 6 when I wrote my first program. I was interested in ship modeling at the time, and my first program calculated the height of each mast based on the width of the ship at three different points. After that I became interested in model railroading in N scale, and my next few programs were to help me lay out the tracks. Programming was just a means to an end back then.
|
|
|
|
|
Jon Rista wrote:
The only problem you would have is embedding images in a PDF. I have no idea how you would do that.
That's precisely where my point lay. PDF is a richer format than XSL-FO would allow, I would think. I didn't think I was snappy though, I was a little pre-annoyed because this was also posted in the lounge, but I was really hoping to find out if it was possible - I don't know that much about XSL-FO.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Well, if your converting from XSL-FO to PDF, its unlikely that you have images. XSL-FO is a formatting language, and I normally see it used to format text based information. Actually, I dont think I've ever seen it used with images, so far. That would make it simpler to translate into a PDF.
PDF seems to follow the same sort of spec as MIME. You define objects, be it text or image, along with formatting and encoding instructions (well, as far as I have been able to discern from opening .pdf's in wordpad anyway). You can see where images begin and end by the binary data, and you can usually make out paragraphs and other formatting markup. Its kind of intriguing, and I'd love the challenge of writing a translator for XSL-FO to PDF. I've got too many things on my plate right now, though. 
|
|
|
|
|
Here is the Apache FOP project[^] for you. binaries and full source code.
You've got this one[^] too (written in Java as well). The interesting stuff is I wanted to provide you with entry points. Now you'll probably get simple C++ implementations by searching these, related, or by posting on a xml NG (public comp.xml NG is highly recommended, as well as the W3C XSL-FO ml [^]of course).
How low can you go ? (MS rant)
|
|
|
|
|
use Antenna House XSL Formatter - you can use it to generate PDFs from XML
http://www.antennahouse.com/[^]
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Given:
class VirtualClass
{
public virtual void VirtualMethod()
{
Console.WriteLine("VirtualClass:VirtualMethod");
}
}
class OverrideClassA : VirtualClass
{
public override void VirtualMethod()
{
Console.WriteLine("OverrideClassA:VirtualMethod");
base.VirtualMethod();
}
}
class OverrideClassB : OverrideClassA
{
public override void VirtualMethod()
{
Console.WriteLine("OverrideClassB:VirtualMethod");
base.VirtualMethod();
}
}
and the instantiation:
OverrideClassB ocb=new OverrideClassB();
How can I access just the VirtualMethod in OverrideClassA? In C++, I used to be able to say ((OverrideClassA)ocb).VirtualMethod(); , but this still invokes the "B" class method in C#.
How do I do this? (A typical case might be where I have an edit control that I've derived some functionality, and in a particular case, I want to use the base class' implementation).
Thanks,
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator.
|
|
|
|
|
I've not been inn this exact scenario, but typically I've used the base keyword to get at the base classes procedures.
so you would have something like this...
base.Virtualmethod();
It's been a while and I could be wrong
Mark Conger
|
|
|
|
|
base is only available in a subclass of base. You couldn't call base on an instance of an object.
Virtual methods are supposed to allow the instantiation of any of the child classes parent virtual methods. I'm sure C# provides a way to do it, and if I find it, I'll let ya know. 
|
|
|
|
|
Um, I'm confused here. You say I'm wrong (I think) but your first statement says I'm right. If you go from the example code he gave, he is trying to call a function that he inherited from the parent class (sublassing). I've done something similar to this in control programming and it worked fine using the base keyword.
I'm not trying to be hostile. I'm just confused as to your response since, based on my understanding of the example, you're saying I'm right and wrong. Could you please elaborate using Marc's example to illustrate why base would not work?
Mark Conger
|
|
|
|
|
Sorry....let me see if I can clarify (based on my understanding of the original question).
From what I understood, the question was can you explicitly instantiate a virtual method of a base class from an instance of a subclass:
Quote-----
"and the instantiation:
OverrideClassB ocb=new OverrideClassB();
How can I access just the VirtualMethod in OverrideClassA? In C++, I used to be able to say ((OverrideClassA)ocb).VirtualMethod();, but this still invokes the "B" class method in C#."
ocb is an instance of OverrideClassB. In C++, you can do ((OverrideClassA)ocb).VirtualMethod() to explicitly call the virtual method of a base class on an instance of a subclass.
My response was stating the fact that the object base is only available in the class declaration. Its not available on the instance of a class. Therefor, its not possible to call base on an instance of a class, such as the instance ocb used above. Base is available in the definition of a class, not in an instance.
Example:
class BaseClass
{
public virtual void Method()
{
}
}
class DerivedClass: BaseClass
{
public override void Method()
{
base.Method()
}
}
DerivedClass dc = new DerivedClass();
dc.Method();
Hope that helps. Sorry for the misunderstanding.
|
|
|
|
|
I have a class collection which contains another collection which contains another collection etc.
-StockCollections[]
-StockCollection
-StockItems[]
-StockItem
-StockItemColours[]
-StockItemColour
-StockItemSizes[]
-StockItemSize
Pretty simple structure really, just a bit deep.
In the constructor of each collection ([]) class there is some code which queries the database and populates the collection with items.
Now this may sound stupid to you, but I just need to know something: When I construct that top level StockCollections[] collection are all other sub-items and sub-collections also "activated" and populated? Or does it only populate the sub-collections when they are "called" (for instance in a foreach loop (thanks to Nish for the IEnumerable code ).)
If that is the case then I have a problem (as you already guessed) as there may be up to 100 000 StockItems each with 10 to 20 Colour and Size options. Now if all I wanted was the titles of the items in the StockCollections[] collection then that is a huge amount of uneeded overhead.
Do you have any advice as to how you stop this happening? Or do I have to have two constructors for each collection, one which takes a parameter specifying not to load sub-items?
Any advice welcome, thanks
|
|
|
|
|
Paul,
This is what DataSets are for.
That said, if you really want to do it this way, I think you've already answered your own question:
Paul Watson wrote:
Or do I have to have two constructors for each collection, one which takes a parameter specifying not to load sub-items?
Paul
Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop
|
|
|
|
|
Paul Riley wrote:
This is what DataSets are for
Well unless you know something different about DataSets I "have" to use classes because there is going to be quite a bit of blogic involved in the handling of the data. It is not just a simple case of pull-and-display (for instance part of the database is 5 years old and has no relationships, no primary keys, no identity seeds and allows null values.... !!! And I cannot change it because a legacy system depends on the database not changing.)
|
|
|
|
|
Paul Watson wrote:
Well unless you know something different about DataSets I "have" to use classes because there is going to be quite a bit of blogic involved in the handling of the data.
Hmm... I see your problem. I see where yours and James' conversation is going and it's exactly what I'd be saying next, so I'll back off and leave you guys to it
Paul
Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop
|
|
|
|
|
One more thought, and I say it in full knowledge of the fact that the answer is probably "No", but is there no way you can have a Query/View put on the database to do the fiddling for you, making it appear to you as a simple table but to the legacy software like the hideous mess it already is?
Paul
Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop
|
|
|
|
|
Paul Watson wrote:
When I construct that top level StockCollections[] collection are all other sub-items and sub-collections also "activated" and populated? Or does it only populate the sub-collections when they are "called" (for instance in a foreach loop (thanks to Nish for the IEnumerable code ).)
That depends on how your constructor is set up, if each of the constructors automatically fill the objects underlying collection, then yes all 100 000 StockItems with all their Colour and Size options will be loaded.
What you can do to help prevent that is make each object's collection a property, in the get method for that property you can populate the collection (if you haven't done so already).
In psuedo/C#-code for how you would do this with the StockItem class (since I have a pretty good idea how that is used ).
class StockItem
{
private StockItemColour[] colours = null;
....
public StockItemColour[] StockItemColours
{
get
{
if( colours == null )
{
colours = FetchColoursFromDB();
}
return colours;
}
}
...
} HTH,
James
Sig code stolen from David Wulff
|
|
|
|
|
James T. Johnson wrote:
What you can do to help prevent that is make each object's collection a property
And with those words you made me a happy man!
That is what I have done:
public class StockCollection
{
public StockItems StockItems
{
get {return new StockItems(this);}
}...
So in essence that return new StockItems(this) bit is only actually "run" when I use that property of the class instance, right? e.g.:
StockCollections stockcollectionsTest = new StockCollections();
foreach (StockCollection stockcollectionCurrent in stockcollectionsTest)
{
Response.Write("Collection Title: " + stockcollectionCurrent.Title + "<br />");
foreach(StockItem stockitemCurrent in stockcollectionCurrent.StockItems)
{
Response.Write("StockItem Title: " + stockitemCurrent.Title + "<br />");
}
}
I guess I should have actually stated in my question that the sub-collections are exposed as get properties of the items (it is often hard to figure out at which level to pitch a question. To high and people who may have the answer you are looking for ignore it, too low and you have to go through fifty sub questions to get to the heart f the matter.)
Properties rock overall IMO
Thanks James.
|
|
|
|
|
Hmmm, hard to use the Quote button with this one...
Paul Watson wrote:
// At this point property StockItems has not been "run" and therefore no sub-items populated, right?
Correct
Paul Watson wrote:
// But now it has been populated because of the stockcollectionCurrent.StockItems just above, right?
Correct again
Paul Watson wrote:
get {return new StockItems(this);}
I would consider changing this to cache the value returned like I did in my example; otherwise you'll be fetching the data from the DB each time you access the StockItems property.
Of course you may have left that detail out again
James
Sig code stolen from David Wulff
|
|
|
|
|
James T. Johnson wrote:
Of course you may have left that detail out again
Nope, good idea of yours, thanks
James T. Johnson wrote:
Correct again
Thanks for your help James, much appreciated.
p.s. Daniel now has me worried that my class setup is, while elegant, a bad idea Do you agree, disagree? And why have collections at all if they are a bad idea? (thankfully apart from the medium sized product database, the actual traffic to this site is low and it will only be running on one server. Not exactly a high stress site )
|
|
|
|
|