Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 25 Jun 2019, 12:23
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Two columns in leafpad or geany ??
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 6 of 6 [84 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6
Author Message
musher0

Joined: 04 Jan 2009
Posts: 14194
Location: Gatineau (Qc), Canada

PostPosted: Thu 09 May 2019, 15:23    Post subject:  

Maybe redact Sara's phone number...? One ever knows, in this day and age...
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5533
Location: Republic of Novo Zelande

PostPosted: Thu 09 May 2019, 15:38    Post subject:  

musher0 wrote:
Maybe redact Sara's phone number...? One ever knows, in this day and age...
Actually thats not anyone's number. It's fictitious. Well - supposed to be fictitious anyway. Probably connects to someone in the Bahamas or Moscow. Confused
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14194
Location: Gatineau (Qc), Canada

PostPosted: Thu 09 May 2019, 16:40    Post subject:  

Ah. Ok.
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1842
Location: Japan

PostPosted: Thu 09 May 2019, 22:36    Post subject:  

greengeek wrote:
Line 8 in the output has minor misalignment but i cannot see what is unusual about that line in the source "personal" file. ...
(EDIT : Seems to be the apostrophe in "don't" that is upsetting the alignment. Maybe different encoding or something.
Not maybe. If you *would* use MMview (SCNR Wink ) you could see that this file is UTF-8 encoded while the file ToDoWork_Sample.txt is US_ASCII encoded. And if you would use the newest version you could even spot the problem, using 'Hexview' (not ''Hexdump'). It's indeed the apostrophe, which in this case is not the usual ASCII apostrophe but Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). This character takes up 3 bytes instead of the usual 1 byte. The expand command calculates the tab stop based on bytes, not characters, so it sees 25 bytes in the text when you see only 23 characters, adds 8 spaces and voilà, 33 bytes.

Well, let's call this a bug. This is not how the expand command should work. Buggy in version 8.19 and still buggy in 8.24.
The solution: use busybox expand instead. It's not the first time that busybox is better maintained than the GNU utilities.

Still your code will fail if your text files contain tabs. Never ever happens? OK, that's for you to decide. Otherwise you will need a more robust solution, e.g. awk instead of expand.
3_byte_character_in_text.png
 Description   
 Filesize   69.48 KB
 Viewed   143 Time(s)

3_byte_character_in_text.png

Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5533
Location: Republic of Novo Zelande

PostPosted: Sat 11 May 2019, 13:29    Post subject:  

MochiMoppel wrote:
Well, let's call this a bug. This is not how the expand command should work. Buggy in version 8.19 and still buggy in 8.24.
The solution: use busybox expand instead. It's not the first time that busybox is better maintained than the GNU utilities.
Awesome analysis, thank you.

Now corrected to
Code:
busybox expand
pending future experimentation with other options.

Meantime I will work with what you guys have kindly given me so far and hope to structure the gui so that I can easily choose between equal or non-equal column widths, and between portrait and landscape text outputs.

Will post another gui when tested.

cheers!

PS: I am not sure how i end up with some files ascii and some utf-8. I suspect my leafpad and geany are set up differently.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5533
Location: Republic of Novo Zelande

PostPosted: Sat 11 May 2019, 14:08    Post subject:  

Here is my latest ToDo gui to produce text output - with choice of Landscape (equal or non-equal column width) or Portrait (with equal or non-equal column widths).

Still some refining to do but I'm pretty happy how close this gets me to my original goal of using simple leafpad files to build my daily list.

EDIT : See next post for newer version
gui_0.3.jpg
 Description   
 Filesize   36.16 KB
 Viewed   125 Time(s)

gui_0.3.jpg

ToDo_2colTEXT_gui_gg-0.3.gz
Description  Deprecated - please consider using the newer gui in the next post instead

Remove fake .gz suffix
Make executable.
Click script
gz

 Download 
Filename  ToDo_2colTEXT_gui_gg-0.3.gz 
Filesize  4.71 KB 
Downloaded  36 Time(s) 

Last edited by greengeek on Wed 15 May 2019, 12:10; edited 2 times in total
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5533
Location: Republic of Novo Zelande

PostPosted: Wed 15 May 2019, 02:58    Post subject:  

Revision 0.4 of the text gui.

This adds the ability to direct print A4 Portrait or A4 Landscape to the default printer - and allowing the choice of equal columns or non equal columns.
(You must use the "create" button to build the file before you try to print it)

Issues i need to consider:

- How to configure for US Letter?

- How to choose smaller font to get more text on page (more columns across page)

- Check why "equal columns" (portrait and landscape) files seem to have a couple of extra spaces at left hand side. (Not a problem - just something I would like to understand)

Remove fake .gz suffix
Make executable
gui_04.jpg
 Description   
 Filesize   55.38 KB
 Viewed   93 Time(s)

gui_04.jpg

ToDo_2colTEXT_gui_gg-0.4.gz
Description  Remove fake .gz suffix
Make executable
gz

 Download 
Filename  ToDo_2colTEXT_gui_gg-0.4.gz 
Filesize  6.63 KB 
Downloaded  31 Time(s) 
A4LandscapeEqual.jpg
 Description   
 Filesize   66.04 KB
 Viewed   94 Time(s)

A4LandscapeEqual.jpg

A4LandscapeNonEqual.jpg
 Description   
 Filesize   51.8 KB
 Viewed   94 Time(s)

A4LandscapeNonEqual.jpg

A4PortEqual.jpg
 Description   
 Filesize   47.58 KB
 Viewed   94 Time(s)

A4PortEqual.jpg

A4PortNonEqual.jpg
 Description   
 Filesize   47.75 KB
 Viewed   94 Time(s)

A4PortNonEqual.jpg

Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1842
Location: Japan

PostPosted: Wed 15 May 2019, 04:53    Post subject:  

greengeek wrote:
- Check why "equal columns" (portrait and landscape) files seem to have a couple of extra spaces at left hand side. (Not a problem - just something I would like to understand)
They have 2 spaces because you use the paste command for non-equal text and the pr command for equal text, and for the pr command you use the option -o2, which indents each line with 2 spaces. So you did this deliberately. Question remains: Why not stay with paste for all cases?
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5533
Location: Republic of Novo Zelande

PostPosted: Wed 15 May 2019, 05:08    Post subject:  

MochiMoppel wrote:
[They have 2 spaces because you use the paste command for non-equal text and the pr command for equal text, and for the pr command you use the option -o2, which indents each line with 2 spaces. So you did this deliberately.
Ahhh, you are ascribing me with greater understanding of my own actions than is actually the case Smile . I may be responsible for the outcome but that is not quite the same thing as saying that I did it deliberately. I used someones proposed syntax without any accurate understanding, altered it, reshaped it, and magically came up with a result that was more or less tolerable. That is as close to coding as I get Very Happy

Quote:
Question remains: Why not stay with paste for all cases?
Now that I look at it again - I think i got scared by the sed portion of the 'paste' code. That syntax was offered as a way to make unequal columns work - so i guess i felt it was inappropriate to try to go back and re-use it to make equal columns work in a different way. (The 'pr' syntax was offered as the initial way to combine the two source files into two equal columns).

Suitably chastened - i will now sleep on my error and attack it with ferocity again tomorrow.

Cheers!
Smile

ps: and thanks for pointing out the cause of the issue. I really appreciate the help!
edit : Seems that Burunduk already explained the -o2 to me here but it went over my head.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 6 of 6 [84 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0600s ][ Queries: 12 (0.0214s) ][ GZIP on ]