Re: [Ql-Users] Tables

2011-01-01 Thread Marcel Kilgus
Tony Firshman wrote:
 Why on earth is there a habit (in C68 as well I expect, dragging back
 OnT) of not aligning '{' with '}'.  I always do.

Because aligned braces are just wrong :-D

Marcel

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Norman Dunbar
On 31/12/10 12:47, Dilwyn Jones wrote:
 Does anyone know of any software that will convert a html table into
 auto-spaced plain text?
 
 I'm trying to convert some HTML tables into plain text columns for the
 QL. Most HTML-text converters just put a space between columns in the
 table, with the result that the text looks awful. It'd be a big job to
 do this by hand (scan table, pass 1, find all TR and TD tags and keep a
 record of the longest in each column, scan 2, extract the text and pad
 each one with spaces), and although I'm sure I could write such a
 converter, why do so if there's already QL code to do just that?

Don't forget, when you find a table, there is a possibility that there
is another table embedded in between the TD tags! So, you'll have to get
recursive!

Theres a PC program here http://www.nirsoft.net/utils/htmlastext.html
that allows Simple tables can be delimited by spaces, tab characters,
commas, or CRLF so it's probably not what you need.


Cheers,
Norman.

-- 
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
Pudsey
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Norman Dunbar
 each one with spaces), and although I'm sure I could write such a
 converter, why do so if there's already QL code to do just that?
And then you have cells with COLSPAN and/or ROWSPAN to cope with!
And table captions

:-)


Cheers,
Norman.

-- 
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
Pudsey
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Tony Firshman

Norman Dunbar wrote, on 31/Dec/10 13:22 | Dec31:

each one with spaces), and although I'm sure I could write such a
converter, why do so if there's already QL code to do just that?

And then you have cells with COLSPAN and/or ROWSPAN to cope with!
And table captions


... and mis-configured tables.
Beware - browsers will cope (successfully in the main) with all sorts of 
bad html.
This is terrible of course, not just because it encourages bad coding, 
but also the programmer then does not *see* that the code is bad.


... much like I suppose Superbasic's habit of implicitly adding missing 
END statements.


Tony

--
QBBS (QL fido BBS 2:257/67) +44(0)1442-828255
   t...@firshman.co.uk http://firshman.co.uk
Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman
TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Norman Dunbar
On 31/12/10 13:22, Norman Dunbar wrote:
 each one with spaces), and although I'm sure I could write such a
 converter, why do so if there's already QL code to do just that?
 And then you have cells with COLSPAN and/or ROWSPAN to cope with!
 And table captions
And then the stuff that can't be represented as is :

quote, amp, gt, lt etc . These will need translating out of the text
first before checking the lengths.

I'm seeing more and more reasons why, perhaps, there are so few
converters that actually cope!


Cheers,
Norman.

PS. I promise not to put any more downers on this thread!

-- 
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
Pudsey
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Dilwyn Jones

Norman Dunbar wrote:

On 31/12/10 12:47, Dilwyn Jones wrote:
Does anyone know of any software that will convert a html table 
into

auto-spaced plain text?

I'm trying to convert some HTML tables into plain text columns for
the QL. Most HTML-text converters just put a space between columns
in the table, with the result that the text looks awful. It'd be a
big job to do this by hand (scan table, pass 1, find all TR and TD
tags and keep a record of the longest in each column, scan 2,
extract the text and pad each one with spaces), and although I'm
sure I could write such a converter, why do so if there's already 
QL

code to do just that?


Don't forget, when you find a table, there is a possibility that 
there

is another table embedded in between the TD tags! So, you'll have to
get recursive!
Curses and Recurses! Actually, the tables concerned are pretty simple 
text column tables, no nests of tables, so anything which produces a 
file I can handle more easily with less hand conversion should be OK. 
Most non-space delimiters such as tabs between columns could be easily 
handled anyway.


Must admit I hadn't thought of the Entity characters, but even those 
aren't too hard to process if you make the assumption that each 
entity=1 text character (which they are likely to be in the particular 
files I'm converting. There are loads of tags and entities which I 
might run into, but luckily the text tables in these files are pretty 
simple affairs,.


Theres a PC program here 
http://www.nirsoft.net/utils/htmlastext.html
that allows Simple tables can be delimited by spaces, tab 
characters,

commas, or CRLF so it's probably not what you need.
Had a quick look, will give this a try, looks pretty promising from 
the quick read. And its free too!


Tony Firshman wrote:

... and mis-configured tables.
Beware - browsers will cope (successfully in the main) with all 
sorts of

bad html.
I know that to my cost when I took over Ann's craft association site. 
Not that the html previously used was bad, it was just optimised for 
Firefox and the previous webmaster didn't like IE so never checked it, 
despite the fact that by number, more people probably use IE than most 
other browsers. See an example of this (unless it's been fixed by now) 
by looking at Quanta website's home page in IE and Firefox to see how 
things can go wrong with IE!


This is terrible of course, not just because it encourages bad 
coding,

but also the programmer then does not see that the code is bad.
I know what you mean. Luckily, what I want to do is pretty 
simple-minded so the program Norman suggested MIGHT just do enough for 
what I want. If it doesn't, I'll just write a simple routine to cope 
with the basic tables I want to process. Even if I can't make a 100% 
perefct conversion of the tables I'll content myself with producing 
something that needs less work at the QL end.


... much like I suppose Superbasic's habit of implicitly adding 
missing

END statements.
Yup. Just try throwing some of those programs at SBASIC, it'll soon 
tell you there's something missing, though not necessarily the correct 
point in the listing!


Debugging some older SuperBASIC programs like that can take quite a 
while.


Thanks,

Dilwyn Jones 




___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Tony Firshman

Dilwyn Jones wrote, on 31/Dec/10 14:36 | Dec31:
snip

... much like I suppose Superbasic's habit of implicitly adding missing
END statements.

Yup. Just try throwing some of those programs at SBASIC, it'll soon tell
you there's something missing, though not necessarily the correct point
in the listing!

Debugging some older SuperBASIC programs like that can take quite a while.


Much much worse is when you miss off a closing '}' in Perl (and probably 
all other languages that use {} ).  Then you get told by the parser that 
there is a missing '}' at the end of the program!


I really like Python.  It uses formatting rather than {}; characters.
You are *forced* to lay out the program intelligently, although I do try 
for *all* my programming - makes debugging easier.


Why on earth is there a habit (in C68 as well I expect, dragging back 
OnT) of not aligning '{' with '}'.  I always do.


Tony
--
QBBS (QL fido BBS 2:257/67) +44(0)1442-828255
   t...@firshman.co.uk http://firshman.co.uk
Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman
TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread gdgqler

On 31 Dec 2010, at 15:12, Tony Firshman wrote:

 Dilwyn Jones wrote, on 31/Dec/10 14:36 | Dec31:
 snip
 ... much like I suppose Superbasic's habit of implicitly adding missing
 END statements.
 Yup. Just try throwing some of those programs at SBASIC, it'll soon tell
 you there's something missing, though not necessarily the correct point
 in the listing!
 
 Debugging some older SuperBASIC programs like that can take quite a while.
 
 
 Much much worse is when you miss off a closing '}' in Perl (and probably all 
 other languages that use {} ).  Then you get told by the parser that there is 
 a missing '}' at the end of the program!
 
 I really like Python.  It uses formatting rather than {}; characters.
 You are *forced* to lay out the program intelligently, although I do try for 
 *all* my programming - makes debugging easier.
 
 Why on earth is there a habit (in C68 as well I expect, dragging back OnT) of 
 not aligning '{' with '}'.  I always do.
 

Use Assembler instead. Cleaner, faster, better.

George
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Tables

2010-12-31 Thread Dave Walker

 -Original Message-
 From: ql-users-boun...@lists.q-v-d.com [mailto:ql-users-
 boun...@lists.q-v-d.com] On Behalf Of Tony Firshman
 Sent: 31 December 2010 15:12
 To: ql-us...@q-v-d.com
 Subject: Re: [Ql-Users] Tables
 
 Why on earth is there a habit (in C68 as well I expect, dragging back
 OnT) of not aligning '{' with '}'.  I always do.

In most languages this is normally a programmers preference.  Some people
like the open braces to be at the end of a line with the close brace being
on at the end of the line that closes the block.  Others (myself included)
prefer to put the opening brace on the next line by itself that the start of
block is more clearly isolated and then the closing brace also on its own
line lined up with the opening brace.  You also get hybrid answers.   That
is probably why the C indent program was produced so that you can process
an existing source file to suit your own layout preferences. 

Dave Walker

Tel:  +44 (0)1707 652791
Mob: +44 (0)7999 218953
Web: http://www.itimpi.com
Skype:  itimpi


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm