Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-23-2015, 06:17 PM   #31
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 6,974
Karma: 6562815
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O
Some things are more tolerant to CR/LF than others, but it's just bad practice to mix line-endings, and most everything we do here is guaranteed to expect/work with unix line-endings, while it might only once in a blue moon tolerate CR/LF without ill effect.
Hence the go-to recommendation is unix line-endings and a decent editor, because we're sure *that* expected setup will work. Anything else would just add 'noise' and complicate support. Better eliminate potential issues early, where we can.
Plus, one byte less per line, win/win ^^.

One of the many things that will not ever bear CR/LFs are shell scripts, for instance.

Last edited by NiLuJe; 04-23-2015 at 06:19 PM.
NiLuJe is offline   Reply With Quote
Advert
Old 04-23-2015, 06:23 PM   #32
shalym
Wizard
shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.
 
shalym's Avatar
 
Posts: 1,960
Karma: 19000000
Join Date: Feb 2012
Location: New England
Device: KPW 1, 2, and 3, Voyage, Oasis 2, Kindle Fire, Kobo Aura HD, Onyx Lynx
Quote:
Originally Posted by NiLuJe View Post
Some things are more tolerant to CR/LF than others, but it's just bad practice to mix line-endings, and most everything we do here is guaranteed to expect/work with unix line-endings, while it might only once in a blue moon tolerate CR/LF without ill effect.
Hence the go-to recommendation is unix line-endings and a decent editor, because we're sure *that* expected setup will work. Anything else would just add 'noise' and complicate support. Better eliminate potential issues early, where we can.
Plus, one byte less per line, win/win ^^.

One of the many things that will not ever bear CR/LFs are shell scripts, for instance.
Well, then, notepad must not use CR/LFs, then, since I've written shell scripts using notepad.

Shari
shalym is offline   Reply With Quote
Old 04-23-2015, 06:28 PM   #33
knc1
Analog Forever!
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 15,016
Karma: 16548859
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by shalym View Post
Well, then, notepad must not use CR/LFs, then, since I've written shell scripts using notepad.

Shari
Bad guess.

How did you transfer the script from the Windows machine you wrote it on to the Linux (or other *nix) system you ran it on?
knc1 is offline   Reply With Quote
Old 04-23-2015, 06:34 PM   #34
shalym
Wizard
shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.
 
shalym's Avatar
 
Posts: 1,960
Karma: 19000000
Join Date: Feb 2012
Location: New England
Device: KPW 1, 2, and 3, Voyage, Oasis 2, Kindle Fire, Kobo Aura HD, Onyx Lynx
Quote:
Originally Posted by knc1 View Post
Bad guess.

How did you transfer the script from the Windows machine you wrote it on to the Linux (or other *nix) system you ran it on?
FTP. How do you transfer files from one system to another?

Shari
shalym is offline   Reply With Quote
Old 04-23-2015, 07:01 PM   #35
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 6,974
Karma: 6562815
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O
By "how", knc1 meant both over which protocol, but most importantly, via which software, because some are known to silently (or not so silently) fudge with line-endings.

We've already had a couple of interesting and excruciatingly long & pointless debugging back-and-forth sessions simply because an unarchiver or a file transfer program was trying to be cute.
NiLuJe is offline   Reply With Quote
Advert
Old 04-23-2015, 07:07 PM   #36
shalym
Wizard
shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.
 
shalym's Avatar
 
Posts: 1,960
Karma: 19000000
Join Date: Feb 2012
Location: New England
Device: KPW 1, 2, and 3, Voyage, Oasis 2, Kindle Fire, Kobo Aura HD, Onyx Lynx
Quote:
Originally Posted by NiLuJe View Post
By "how", knc1 meant both over which protocol, but most importantly, via which software, because some are known to silently (or not so silently) fudge with line-endings.

We've already had a couple of interesting and excruciatingly long & pointless debugging back-and-forth sessions simply because an unarchiver or a file transfer program was trying to be cute.
I usually use filezilla, but I have used WsFtp and (rarely) CuteFTP or even the built in FTP client in Windows Explorer. I've also (in a pinch) done it using the command line from Dos, but that is a horrible memory from the long ago dark days.

Shari
shalym is offline   Reply With Quote
Old 04-23-2015, 07:42 PM   #37
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,223
Karma: 83049275
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by shalym View Post
Actually, I see references to this all the time, and I just don't understand what the issue is. I use notepad. not Notepad++, just the regular notepad that comes with Windows. I've edited config files for my Kobo and my Kindle, and edited html, vbscript, javascript and probably many other things I'm not remembering, all using plain old vanilla notepad. I've never had a problem with any system not recognizing the line endings.

Maybe people who are having problem are using either Wordpad or MS Word instead of notepad? Neither of those will work for working in code, but again...I've been working with scripts and devices for years, and never had a problem with notepad.

Shari
The tests conclusively point to the issue of using CRLF, insomuch as there are utilities or manual editing for switching to *nix line endings, and that is the specific action that gets things working.

Regardless, if you create or edit a file using Windows' built-in Notepad, you will be working with CRLF. That may or may not blow up on you. I have no idea whether this specific file must use *nix line endings (I was not the one who said it was required), but of a surety, there are things that do depend on it.
(As for html and javascript, line endings are optional, so naturally there would be no problem either way. vbscript is a Windows thing, so if it depends on anything it will be DOS line endings...)

One way to test your claim (since it runs contradictory to the experience of, well, every other test by any other human being on the planet) would be to open one of those files with Notepad++, which will tell you whether the file uses *nix or DOS line endings.


And check the manual for the transfer program you use, to find out if it has the helpful feature of auto-correcting line endings. I am pretty sure Filezilla at least does that. EDIT: Yup -- https://wiki.filezilla-project.org/Data_Type

Last edited by eschwartz; 04-23-2015 at 07:45 PM.
eschwartz is offline   Reply With Quote
Old 04-23-2015, 07:48 PM   #38
knc1
Analog Forever!
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 15,016
Karma: 16548859
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by shalym View Post
I usually use filezilla, but I have used WsFtp and (rarely) CuteFTP or even the built in FTP client in Windows Explorer. I've also (in a pinch) done it using the command line from Dos, but that is a horrible memory from the long ago dark days.

Shari
Ah, there you go - -
Big Daddy B. Gates is holding your hand in the background -
and translating line endings for you.
knc1 is offline   Reply With Quote
Old 04-23-2015, 08:41 PM   #39
shalym
Wizard
shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.
 
shalym's Avatar
 
Posts: 1,960
Karma: 19000000
Join Date: Feb 2012
Location: New England
Device: KPW 1, 2, and 3, Voyage, Oasis 2, Kindle Fire, Kobo Aura HD, Onyx Lynx
Quote:
Originally Posted by eschwartz View Post
The tests conclusively point to the issue of using CRLF, insomuch as there are utilities or manual editing for switching to *nix line endings, and that is the specific action that gets things working.

Regardless, if you create or edit a file using Windows' built-in Notepad, you will be working with CRLF. That may or may not blow up on you. I have no idea whether this specific file must use *nix line endings (I was not the one who said it was required), but of a surety, there are things that do depend on it.
(As for html and javascript, line endings are optional, so naturally there would be no problem either way. vbscript is a Windows thing, so if it depends on anything it will be DOS line endings...)

One way to test your claim (since it runs contradictory to the experience of, well, every other test by any other human being on the planet) would be to open one of those files with Notepad++, which will tell you whether the file uses *nix or DOS line endings.


And check the manual for the transfer program you use, to find out if it has the helpful feature of auto-correcting line endings. I am pretty sure Filezilla at least does that. EDIT: Yup -- https://wiki.filezilla-project.org/Data_Type
Ok...so I've downloaded notepad++ and looked at 5 different scripts that I've either created or edited using notepad.

What am I supposed to be seeing? As far as I can tell the only difference is that it adds pretty colors to highlight different elements of the script, kind of like other script editors do. I see nothing to indicate anything about what kind of line endings the file is using. Where would I see that?

Shari
shalym is offline   Reply With Quote
Old 04-23-2015, 08:53 PM   #40
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,223
Karma: 83049275
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
In the status bar at the bottom, it should indicate DOS or Unix.

The other great feature is that if the file you open is using *nix line endings, it will read it as a DOS file.

Rather than treating everything as one giant line, which I do promise you will happen if you copy *nix files from a linux computer to a flashdrive to a Windows computer instead of using FileZilla... and then try to open that file in the default Notepad.
eschwartz is offline   Reply With Quote
Old 04-23-2015, 10:58 PM   #41
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,713
Karma: 2006157
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
Quote:
Originally Posted by shalym View Post
I see nothing to indicate anything about what kind of line endings the file is using. Where would I see that?
use this option:
Click image for larger version

Name:	line endings.JPG
Views:	386
Size:	53.7 KB
ID:	137580
thomass is offline   Reply With Quote
Old 04-24-2015, 03:45 AM   #42
odamizu
maniac
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 630
Karma: 1636110
Join Date: Mar 2015
Device: Kindle Oasis & Voyage, iOS
Thank you again everyone for all your help, with a special to ecostin for finding and sharing this hack. It works great!

Quote:
Originally Posted by tono1020 View Post
... Default values are: 7.13 7.81 8.49 9.17 10.53 12.56 16.98 29.2 ...

I calculated few value sets for myself, but only those values [7.49 8.43 9.37 10.31 11.25 12.19 13.13 14.07] worked for me. Don't know why.

This article explains how to calculate those values: http://www.the-ebook.org/forum/viewt...424889da87d14b. Article is in russian language, but you can "google translate" it.
That's interesting. I wonder why some of your sets didn't work and what criteria the numbers need to follow in order for them to work. I went to the Russian forum, but I didn't really understand it, even with the help of Google Translate

There was something in there about increments of .34, and indeed the default settings increase by multiples of .34 (.68, 1.36, 2.03, 4.42, 12.22). Though I notice you increased each setting by .94 and it worked, so clearly the .34 thing isn't required.

In any case, I played with the numbers (using multiples of .34 for each increment), mostly because I like the first 4 or 5 default settings; it's the upper range that I wanted to adjust. If anyone's interested, these sets all worked on my KV (default settings in black, my adjustments in blue):

7.13 7.81 8.49 9.17 9.85 10.53 11.21 11.89

7.13 7.81 8.49 9.17 10.19 11.21 12.23 13.25

7.13 7.81 8.49 9.17 10.53 11.89 13.25 14.61

7.13 7.81 8.49 9.17 10.53 12.56 13.92 15.28

7.13 7.81 8.49 9.17 10.53 15.28 16.64 18.0

Last edited by odamizu; 04-24-2015 at 01:19 PM. Reason: added info
odamizu is offline   Reply With Quote
Old 04-24-2015, 03:48 AM   #43
odamizu
maniac
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 630
Karma: 1636110
Join Date: Mar 2015
Device: Kindle Oasis & Voyage, iOS
P.S. re: all this talk of line endings (and thank you eschwartz for the amusing overview), I feel like a child sitting at the grown-up's table struggling to understand what you're all talking about!

I edited the text files using an HTML editor on Mac OS X, then saved the file in "plain text" format, and it worked nicely on my Kindle.

I'm curious: Did it work because I saved it as plain text (i.e., does plain text = *nix line endings?) or did it work because I'm on a Mac and OS X is Unix-based?
odamizu is offline   Reply With Quote
Old 04-24-2015, 04:24 AM   #44
knc1
Analog Forever!
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 15,016
Karma: 16548859
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by odamizu View Post
- - - -
I'm curious: Did it work because I saved it as plain text (i.e., does plain text = *nix line endings?) or did it work because I'm on a Mac and OS X is Unix-based?
Both (saved as plain text and your on a *nix based system).
Plain text != type of line endings.
It was the Mac OS (prior to OS X) that used CR for line endings.

(Darn. Some good must have come from living with a roomful of computers for over a 1/2 century.)

Last edited by knc1; 04-24-2015 at 04:50 AM.
knc1 is offline   Reply With Quote
Old 04-24-2015, 05:49 AM   #45
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,713
Karma: 2006157
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
Quote:
Originally Posted by odamizu View Post
I'm curious: Did it work because I saved it as plain text (i.e., does plain text = *nix line endings?) or did it work because I'm on a Mac and OS X is Unix-based?
The file on this zip has no line ending in it (ie it contains only 1 line of text) I think for this particular file editing software does not matter. (also pay attention to the extension of the resulting file.)

Click image for larger version

Name:	Capture.JPG
Views:	356
Size:	13.5 KB
ID:	137584

Last edited by thomass; 04-24-2015 at 05:52 AM.
thomass is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to edit margins in MOBI file? WDeranged Calibre 2 09-03-2015 05:43 PM
Default Edit Book Edit Window Font? lhuxley Editor 2 03-26-2015 11:11 PM
Kindle Paperwhite edit PDF margins? bseos Amazon Kindle 8 02-10-2014 02:00 PM
Edit Default Kindle PW Font Sizes mthodmn101 Kindle Developer's Corner 10 09-20-2013 11:14 AM
Kindle margins edit? 3bayjunkie Amazon Kindle 3 01-01-2011 11:38 PM


All times are GMT -4. The time now is 04:23 AM.


MobileRead.com is a privately owned, operated and funded community.