Reading LAST line from text file without iterating through the file?

T

Tom Anderson

Wait a bit, flipping out makes you a XOR loser.

Brethren, we can work this out if we just sit down peacefully together,
put on some reggae, and smoke a few pipes of weed. I'm sure we'll soon
come to some agreement about rasta image formats.

tom
 
T

Tom Anderson

Note that it looks like readline does not include the line delimiter
but explicitly include a new line.

Point being that on Windows it is still \n not \r\n.

I think it's more that there's a low-level layer that converts
platform-specific line endings to NL on the way in, and NL back to
platform-specific line endings on the way out. On top of that, readline()
includes the NL.
Docs or system or ... ?

A bookshop or ISBN number would do. Or is it actually Count Prefixes,
Dracula's Greek cousin?

tom
 
A

Arne Vajhøj

I think it's more that there's a low-level layer that converts
platform-specific line endings to NL on the way in, and NL back to
platform-specific line endings on the way out. On top of that,
readline() includes the NL.


A bookshop or ISBN number would do. Or is it actually Count Prefixes,
Dracula's Greek cousin?

There is a description in the manual:

http://h71000.www7.hp.com/doc/731final/4506/4506pro.html#99_record_format_tab
http://h71000.www7.hp.com/doc/731final/4506/4506pro_005.html

Arne
 
T

Tom Anderson


Ah. Ken Wesson had implied that there was a novel with count prefixes.
That's what i was after.

That document is interesting, though, thanks.

I was interested to read that for relative files, "The preferred method of
tracking relative record numbers is to assign them based on some numeric
field within the record, for example, the account number". I would imagine
that for typical data patterns, that would result in a very sparse file.
Typical unix filesystems deal with sparse files efficiently, by not
storing all-zero blocks, and i imagine VMS's filesystem does the same, but
that only works when the areas of zeroes are at least as large as a block
(or perhaps even a cluster - i don't know). If the record size in a
relative file is smaller than a block, i imagine there will be a lot of
empty cells actually stored on disk. Unless there's an indirection layer
between the file and the disk that the manual doesn't mention.

tom
 
A

Arne Vajhøj

Ah. Ken Wesson had implied that there was a novel with count prefixes.
That's what i was after.

I think he was talking about a book having lines terminated with
line beaks not count prefixed lines.
That document is interesting, though, thanks.

I was interested to read that for relative files, "The preferred method
of tracking relative record numbers is to assign them based on some
numeric field within the record, for example, the account number". I
would imagine that for typical data patterns, that would result in a
very sparse file. Typical unix filesystems deal with sparse files
efficiently, by not storing all-zero blocks, and i imagine VMS's
filesystem does the same, but that only works when the areas of zeroes
are at least as large as a block (or perhaps even a cluster - i don't
know). If the record size in a relative file is smaller than a block, i
imagine there will be a lot of empty cells actually stored on disk.
Unless there's an indirection layer between the file and the disk that
the manual doesn't mention.

I have used VMS for 25 years and I have never found and
usage for relative files.

It is always sequential files (flat files) or index-sequential
files (ISAM files).

Arne
 
P

Paul Cager

That's web site applets, not client side applications. What are you doing
presuming to be an expert (rather than a clueless newbie) in
comp.lang.java.programmer if you can't even grasp the difference between
Java applets and Java applications?

Ken - I've got to ask. Do you really believe what you write, or is it
some subtle experiment? In a few weeks will you be saying "Ha! Gotcha!
You all thought I was serious, didn't you?"

Oh, and please, reply to my post, replacing all of my words with
"bark". I'm just itching to find out what _that's_ all about. Some
carefully thought out psychological experiment, I would guess.
 
M

Mike Schilling

Ken Wesson said:
And another paranoiac outs himself.

The other day, I saw a couple dozen posts from you, all the ones I looked at
(admittedly, not nearly all) were you defending yourself against attacks
from a variety of sources. Why, if everyone here is so crazy and vicious,
do you not simply find another place to discuss Java and at most send one
last "Screw yall!"?
 
M

Mike Schilling

Ken Wesson said:
Perhaps I actually hold out hope that some people will see reason.

Usenet flame wars eventually die out from lack of interest, but never in my
decades of observing them have resulted in victory for either side. If
that's what you're waiting for, give up now. It saves time. And there's no
better way to get a permanent reputation as a loon than to continue them
long after everyone else has lost interest.

Just a bit of free advice, probably worth every penny. And I won't be
responding to you again until the discussion is something on-topic.
 
B

blmblm

I still think people should have let me keep containing him in the
Great SWT Program thread. It may have been ugly, but at least it was
only ugly in one single thread which could then be killfiled.

Or you could have done whatever was necessary to follow the
discussion into the other group into which that thread ended up
being redirected. I did what I could, as did a couple of other
semi-regulars, but I guess eventually we all just ran out of steam.
If we'd had one more ally .... Eh, probably not.
 
B

blmblm

Thought so.

Heh. Quoting only some of what you're replying to [*], in a way that
misrepresents it, at least to some extent? Now *that* brings back
some unhappy memories.

[*] Full sentence:

[ snip ]
 
B

blmblm

Which never happened.
Or you could have done whatever was necessary to follow the discussion
into the other group into which that thread ended up being redirected.
I did what I could, as did a couple of other semi-regulars, but I guess
eventually we all just ran out of steam. If we'd had one more ally ....
Eh, probably not.

I'd still like to know what the heck you're talking about here. What
discussion? A Google search finds a thread with the name "Great SWT
Program" in this group, but it's several years old and won't load for me
[1].

[1] http://groups.google.com/group/comp.lang.java.programmer/
browse_thread/thread/ce27f65ea7256d97/bf270adda3877a0f?#bf270adda3877a0f

Topic not found

We're sorry, but we were unable to find the topic you were looking for.
Perhaps the URL you clicked on is out of date or broken?

Yes, the discussion (thread) in question occurred several years ago.
Some people have long memories, I guess, and it *was* rather
memorable; I think by the time the regulars finally convinced
everyone to take the discussion elsewhere the total number of posts
was in the thousands.

The URL you posted doesn't work for me either (though I got a
different error message, which I was too lazy to record), and
an "advanced search" of Google's Usenet archives for posts in
comp.lang.java.programmer with subject "great swt program" returns
three hits, one in a different newsgroup and two that must represent
subsets of the whole thread, since between them they total only
80-something posts. One would like to hope that the whole thread
exists in Google's archives, but whether it's possible to retrieve
it, who knows.

Cue usual complaints about GG, I guess. I'm grateful that someone
took over when DejaNews folded, but -- well, maybe if they had
focused more on the archival aspects than on providing a posting
interface? which is a whole other target for griping, but -- eh.
"Worth at least I paid for it", maybe.
 
B

blmblm

Ken Wesson said:
On Fri, 11 Mar 2011 23:51:37 -0600, Leif Roar Moldskred wrote:

On Mon, 28 Feb 2011 01:45:10 -0600, Leif Roar Moldskred wrote:

And an almost fanatical devotion to the pope.

Maybe you should come in again?

Non sequitur.

Well, it is

Thought so.

Heh. Quoting only some of what you're replying to [*], in a way that
misrepresents it, at least to some extent? Now *that* brings back some
unhappy memories.

[*] Full sentence:
Well, it is _now_ after you cut out the relevant part of my reply and
only left the Monty Python reference.

As with the other time you implied this sort of dishonesty on my part, I
was merely trimming what I wasn't responding to.

Without any indication [*] that you had trimmed anything. An
indication that you had trimmed something would go a long way
toward convincing me that your motives were pure. Absent that --
well, perhaps I'm overly suspicious as a result of a long and
contentious discussion some years ago with someone you rather
remind me of.

[*] "[ .... ]" or "[ snip ]" or something equivalent.
The out-of-left-field
reference to fanatical Catholics in the middle of a discussion of text
file formats was a non sequitur and, as such, cast the entire rest of the
poster's reasoning process into significant question, to my mind at
least. So, I quoted the apparent non sequitur and called it out as such.

In a way that, in my opinion, made it appear that Leif was agreeing
more than he really was. And indeed, his complaint ("it is _now"_)
seems to have been about your quoting only part of his previous post.
I'll admit that in the context of what he actually said:

it's not entirely clear to me how the last sentence (fragment) fits,
but I'm guessing that's because I don't have a clear enough memory of
some Monty Python movie or skit.

Well, whatever. This is almost surely not a useful tangent and I'll
try not to pursue it past this post.
 
B

blmblm

On Wed, 23 Mar 2011 12:05:24 +0000, (e-mail address removed) wrote:

...


One would hope? Why? From the sounds of it, it wasn't a very useful
thread. Whatever it was. :)

Eh. I'll pass on the implicit question in "whatever it was".

As for why I hope it's archived -- well, I'm of the opinion that
if Usenet posts are to be archived at all, the goal should probably
be to archive all of them, since I doubt one could get universal
agreement on what to include and what to leave out. This particular
thread was for the most part wildly off-topic in a Java newsgroup,
but it had its interesting aspects.
 
B

blmblm

Ken Wesson <[email protected]> said:
As with the other time you implied this sort of dishonesty on my part,
I was merely trimming what I wasn't responding to.

Without any indication [*] that you had trimmed anything. An indication
that you had trimmed something would go a long way toward convincing me
that your motives were pure. Absent that -- well, perhaps I'm overly
suspicious as a result of a long and contentious discussion some years
ago with someone you rather remind me of.

[*] "[ .... ]" or "[ snip ]" or something equivalent.

I've never tended to bother much with that. Seemed like a waste of
bandwidth.

YMMV, maybe. I'd rather put in the extra characters (only,
what, eight of them including spaces before and after?) than have
someone think I'm misrepresenting what I'm responding to by taking
something out of context.
I don't think so. "Agreeing" isn't how I would describe "and a fanatical
devotion to the pope", given that the topic had had nothing to do with
religion. Nor "disagreeing".

Say what?

Leif wrote "It is _now_ .... ", and you quoted only "It is", which to
me is a stronger statement of agreement.

I was curious enough to Google "Monty Python" and "fanatical
devotion to the pope". It's from the Spanish Inquisition skit,
and the phrase ("fanatical devotion ....") appears as part of a
list that keeps growing. So I'm guessing the relevance here is
the list that keeps growing. Still a bit of a .... Nope, not
going to give you something you can quote out of context.
 
L

Lew

Ken said:
Ken Wesson wrote:
As with the other time you implied this sort of dishonesty on my part,
I was merely trimming what I wasn't responding to.

Without any indication [*] that you had trimmed anything. An indication
that you had trimmed something would go a long way toward convincing me
that your motives were pure. Absent that -- well, perhaps I'm overly
suspicious as a result of a long and contentious discussion some years
ago with someone you rather remind me of.

[*] "[ .... ]" or "[ snip ]" or something equivalent.

I've never tended to bother much with that. Seemed like a waste of
bandwidth.

That's because then "Ken Wesson"'d have to admit that it had changed the very
meaning of the quote with its disingenuous tactic. Sort of like the movie
reviewer who quotes, "Most amazingly horrible movie ever" as "most amazing
movie ever" and then acts all fake-innocent when called to account for
omitting the "ly horrible".
YMMV, maybe. I'd rather put in the extra characters (only,
what, eight of them including spaces before and after?) than have
someone think I'm misrepresenting what I'm responding to by taking
something out of context.

It actually did misrepresent the quote by leaving out the part that changes
its meaning, the dishonest being.

Oh, come on! Raging against a humorous Monty Python quote? Really?

Really?

(shakes head in resigned wonderment)

Pot, kettle.

Show some reasoning yourself, troll, before presuming to judge others'.

So far what feeble ratiocinative powers you evince have been devoted entirely
to argumentation, down to ludicrous extent.

In a way that completely misrepresented Leif's points, clearly intentionally.

"Ken Wesson" is dishonest.

It doesn't think, period.
Say what?

Leif wrote "It is _now_ .... ", and you quoted only "It is", which to
me is a stronger statement of agreement.

It's a frakking JOKE!

Poke a spear in Jesus's side and see if he's done, what is wrong with "Ken
Wesson"?
I was curious enough to Google "Monty Python" and "fanatical
devotion to the pope". It's from the Spanish Inquisition skit,
and the phrase ("fanatical devotion ....") appears as part of a
list that keeps growing. So I'm guessing the relevance here is
the list that keeps growing. Still a bit of a .... Nope, not
going to give you something you can quote out of context.

It's a standard way of indicating an infinite list, to those not committed to
asrgument over nonsense and who have a sense of humor.

"No true Scotsman." First you say they don't exist at all, then when
presented with the FACTS you say they don't really count. Troll. You are
dishonest, "Ken Wesson". What will you say should someone present statistics
of significant use for these "don't really count" (in your oh-so-exalted
dishonest opinion)? Claim that it doesn't matter because they aren't
"official" or some such dishone<[email protected]>st bullshit?

Whatever it is, it will be bullshit, I'm betting based on your posts so far.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top