Author Topic: StreamReader Problem  (Read 22343 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
Re: StreamReader Problem
« Reply #45 on: April 28, 2009, 05:54:40 AM »
I was thinking that one of the upcoming questions might be along these lines:

How do I link my data for a specific block in my data file to a specific block reference in a specific drawing kind of thing.
The only way I can think of doing this is by tracking drawing name and handles (or a drawing GUID instead of name) and this can be fragile.

However, having re-read some recent posts, I think I was wrong in my assumption. Wannabe is going the other way to what I was thinking - applying his data file to many drawings without any specific linkage.

wannabe

  • Guest
Re: StreamReader Problem
« Reply #46 on: April 28, 2009, 06:01:51 AM »
Cheers all for the quality feedback.


It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8704
  • AKA Daniel
Re: StreamReader Problem
« Reply #47 on: April 28, 2009, 06:22:52 AM »
Doing a 'While True' is never a good idea in my opinion, not the least of which is confusion.
Have a look at some of the examples I've posted using TextReader (as I suggested earlier) for a better way of using a loop to read each line from a file and breaking out when at the end.

Other than that, coming along well.

Personally, no problem with while(true) ( c++, while(1) ) and for( ; ; ) in the
right context.  The compiler optimizes the while loops to be as effecent as the for loop here, and the
intent is known.  But in Wannabe's sample, he is better served with while(coordsFile.Peek() >= 0)





Neither do I, nor do I with goto statements  :evil:

Glenn R

  • Guest
Re: StreamReader Problem
« Reply #48 on: April 28, 2009, 06:25:42 AM »
Nasty boy! Fight! :D

Chuck Gabriel

  • Guest
Re: StreamReader Problem
« Reply #49 on: April 28, 2009, 06:31:08 AM »
Neither do I, nor do I with goto statements  :evil:

You'll burn for that, heretic! :D

Glenn R

  • Guest
Re: StreamReader Problem
« Reply #50 on: April 28, 2009, 06:33:10 AM »
Next thing you know, he'll be expostulating the virtues of VB of all things! ;)
I'm with the Chuckster - burn, baby, burn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: StreamReader Problem
« Reply #51 on: April 28, 2009, 06:33:28 AM »

Neither do I, nor do I with goto statements  :evil:

:D

I'm reminded of this from 'Program Design' by Peter Juliff

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: StreamReader Problem
« Reply #52 on: April 28, 2009, 06:34:37 AM »
hehe - good one.

Chuck Gabriel

  • Guest
Re: StreamReader Problem
« Reply #53 on: April 28, 2009, 06:41:09 AM »
Next thing you know, he'll be expostulating the virtues of VB of all things! ;)

Touché.  I'll just go back to my hole now. :-)

MikeTuersley

  • Guest
Re: StreamReader Problem
« Reply #54 on: April 28, 2009, 10:44:44 AM »
Each time you post these questions, the best solution is to use XML. Serialize/Deserialize removes the readers; Previous/Next Node handles the comparing; etc., etc.

Sorry, but...are you serious?  How do you suggest he get the data in XML format in the first place?
XML is not the Ron Popeil's Dice-o-matic wonder machine.

Paul

It is is most cases but most of you have no idea how to handle or maintain data. Text, CSV, etc. are vehicles of 20 years ago. Look around, everything is in XML for a reason - from AutoCAD settings to Office's new .???x file formats.
« Last Edit: April 28, 2009, 10:52:59 AM by MikeTuersley »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8704
  • AKA Daniel
Re: StreamReader Problem
« Reply #55 on: April 28, 2009, 11:09:42 AM »
You got me there, I didn’t even know who Ron Popeil was till I googled him  :laugh:

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: StreamReader Problem
« Reply #56 on: April 28, 2009, 05:11:18 PM »
< ... >  but most of you have no idea how to handle or maintain data.  < ... >

well, that's just plain cruel ..  :lol:
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

pkohut

  • Guest
Re: StreamReader Problem
« Reply #57 on: April 28, 2009, 07:38:21 PM »
Each time you post these questions, the best solution is to use XML. Serialize/Deserialize removes the readers; Previous/Next Node handles the comparing; etc., etc.

Sorry, but...are you serious?  How do you suggest he get the data in XML format in the first place?
XML is not the Ron Popeil's Dice-o-matic wonder machine.

Paul

It is is most cases but most of you have no idea how to handle or maintain data. Text, CSV, etc. are vehicles of 20 years ago. Look around, everything is in XML for a reason - from AutoCAD settings to Office's new .???x file formats.

I can understand your thinking here, most in this forum don't have a lot of experience with database backends,
xml schema creation, and have little need to share data between applications, it's just the nature of most
AutoCAD programming projects, especially the questions seen in a forum like this.  I use a couple code generators
myself for data persistence and database work.  These save so much time and easy to extend in the future, I
absolutely love them, but not all projects require the processing and storage overhead that also comes with it.

Paul

Spike Wilbury

  • Guest
Re: StreamReader Problem
« Reply #58 on: April 29, 2009, 10:21:22 AM »
Each time you post these questions, the best solution is to use XML. Serialize/Deserialize removes the readers; Previous/Next Node handles the comparing; etc., etc.

Sorry, but...are you serious?  How do you suggest he get the data in XML format in the first place?
XML is not the Ron Popeil's Dice-o-matic wonder machine.

Paul

It is is most cases but most of you have no idea how to handle or maintain data. Text, CSV, etc. are vehicles of 20 years ago. Look around, everything is in XML for a reason - from AutoCAD settings to Office's new .???x file formats.

I can understand your thinking here, most in this forum don't have a lot of experience with database backends,
xml schema creation, and have little need to share data between applications, it's just the nature of most
AutoCAD programming projects, especially the questions seen in a forum like this.  I use a couple code generators
myself for data persistence and database work.  These save so much time and easy to extend in the future, I
absolutely love them, but not all projects require the processing and storage overhead that also comes with it.

Paul

For MikeTuersley - and - Paul

It will be interesting to know how both of you come up with those conclusions.

Tuoni

  • Gator
  • Posts: 3032
  • I do stuff, and things!
Re: StreamReader Problem
« Reply #59 on: April 29, 2009, 10:31:38 AM »
Each time you post these questions, the best solution is to use XML. Serialize/Deserialize removes the readers; Previous/Next Node handles the comparing; etc., etc.

Sorry, but...are you serious?  How do you suggest he get the data in XML format in the first place?
XML is not the Ron Popeil's Dice-o-matic wonder machine.

Paul

It is is most cases but most of you have no idea how to handle or maintain data. Text, CSV, etc. are vehicles of 20 years ago. Look around, everything is in XML for a reason - from AutoCAD settings to Office's new .???x file formats.

I can understand your thinking here, most in this forum don't have a lot of experience with database backends,
xml schema creation, and have little need to share data between applications, it's just the nature of most
AutoCAD programming projects, especially the questions seen in a forum like this.  I use a couple code generators
myself for data persistence and database work.  These save so much time and easy to extend in the future, I
absolutely love them, but not all projects require the processing and storage overhead that also comes with it.

Paul

For MikeTuersley - and - Paul

It will be interesting to know how both of you come up with those conclusions.
I agree.