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

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 06-10-2019, 02:05 PM   #1036
jhh
Member
jhh began at the beginning.
 
Posts: 15
Karma: 10
Join Date: May 2019
Device: KT4
Ok, @NiLuJe and @ilovejedd, thanks a lot for your work so far!
jhh is offline   Reply With Quote
Old 06-10-2019, 02:48 PM   #1037
Frenzie
Guru
Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.
 
Posts: 680
Karma: 115152
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Quote:
Originally Posted by NiLuJe View Post
Can you try this random shot in the dark patch (based on the fact that the KT4 output looks eerily similar to the one from Kobo's Mk. 7 devices):
That can't work. For a quick test, it should be something like this. (See here why not.)

Code:
diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua
index 501d0735..2505f8dc 100644
--- a/frontend/device/kindle/device.lua
+++ b/frontend/device/kindle/device.lua
@@ -755,6 +755,7 @@ function KindleBasic3:init()
 
     Kindle.init(self)
 
+    self.input.snow_protocol = true
     self.input.open(self.touch_dev)
     self.input.open("fake_events")
 end

Last edited by Frenzie; 06-10-2019 at 02:51 PM.
Frenzie is offline   Reply With Quote
Old 06-10-2019, 05:01 PM   #1038
jhh
Member
jhh began at the beginning.
 
Posts: 15
Karma: 10
Join Date: May 2019
Device: KT4
Quote:
Originally Posted by Frenzie View Post
That can't work. For a quick test, it should be something like this. (See here why not.)

Code:
diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua
index 501d0735..2505f8dc 100644
--- a/frontend/device/kindle/device.lua
+++ b/frontend/device/kindle/device.lua
@@ -755,6 +755,7 @@ function KindleBasic3:init()
 
     Kindle.init(self)
 
+    self.input.snow_protocol = true
     self.input.open(self.touch_dev)
     self.input.open("fake_events")
 end
I've modified \koreader\frontend\device\kindle\device.lua according to this patch and now it works perfectly!


(I don't have account at github so I won't comment there.)

Last edited by jhh; 06-10-2019 at 05:03 PM.
jhh is offline   Reply With Quote
Old 06-10-2019, 05:16 PM   #1039
Frenzie
Guru
Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.
 
Posts: 680
Karma: 115152
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Great! As soon as #5071 is merged it'll show up in the following nightly. Until then (in one or two days) it'd be best not to update.
Frenzie is offline   Reply With Quote
Old 06-11-2019, 08:44 AM   #1040
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: 8,841
Karma: 13000000
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
Duh. Stupidly simple indeed! Thanks, Frenzie!
NiLuJe is offline   Reply With Quote
Old 06-11-2019, 10:05 AM   #1041
shamanNS
Evangelist
shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.
 
Posts: 475
Karma: 1200116
Join Date: Feb 2010
Location: Serbia
Device: Kindle PW3[300dpi] , Kindle PW1
Quote:
Originally Posted by Frenzie View Post
Not only is it not a syntax error, but removing trailing commas is bad practice.

Code:
return {
    ["cre_header_status_font_size"] = 40,
    ["copt_line_spacing"] = 110,
    ["disable_double_tap"] = true,
    ["copt_render_dpi"] = 300,
    ["start_with"] = "last",
    ["disable_kobolight"] = true,
    ["cre_header_status_font_size"] = 30,
    ["full_refresh_count"] = 12,
    ["larger_tap_area_to_follow_links"] = true,
    ["copt_b_page_margin"] = 10,
}
If it was not obvious I was referring to that single comma marked in red color.
So, are you telling me that Lua (or whatever language's 'data structure' / collection/list/array type that code snippet represents) is different than almost any other language under the Sun (even CSS properties list! respect those same conventions) where any type of "enumerating stuff" shouldn't end with a comma as that results in syntax error or parsing error?
Even when returning multiple things as separate objects you wouldn't end that statement with a comma.

Last edited by shamanNS; 06-11-2019 at 10:08 AM.
shamanNS is offline   Reply With Quote
Old 06-11-2019, 10:17 AM   #1042
pazos
cosiñeiro
pazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watchpazos is clearly one to watch
 
Posts: 149
Karma: 10736
Join Date: Apr 2014
Device: BQ Cervantes 4
It is a bad practice because a) it isn't needed and b) can cause problems if someone adds a n+1 element to the returned table.

It is like in C, where
Code:
if(something) return true; else return false;
is valid but a bad practice because in the moment of extending one of the statements it will become non-valid.

So unless you're sure that you always want a single return statement then the following is recommended
Code:
if(something) {return true;} else {return false;}
We can argue that braces are not needed in this particular example, like the comma in your sample case.
pazos is offline   Reply With Quote
Old 06-11-2019, 10:46 AM   #1043
shamanNS
Evangelist
shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.shamanNS ought to be getting tired of karma fortunes by now.
 
Posts: 475
Karma: 1200116
Join Date: Feb 2010
Location: Serbia
Device: Kindle PW3[300dpi] , Kindle PW1
I personally hate people that are omitting curly braces for single statement if/else blocks just as much as I hate people that are omitting parentheses when assigning "arrow functions" that take only one argument to a variable or a constant (even though that particular case is mainly "just" offence in regards to code readability /glanceability. )



But this comma convention thing (in most language that is not optional...) is one of the rare things that are shared between most of the languages... or so I believed
shamanNS is offline   Reply With Quote
Old 06-11-2019, 11:03 AM   #1044
Frenzie
Guru
Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.Frenzie can see what is invisible to the naked eye.
 
Posts: 680
Karma: 115152
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Quote:
Originally Posted by shamanNS View Post
So, are you telling me that Lua (or whatever language's 'data structure' / collection/list/array type that code snippet represents) is different than almost any other language under the Sun (even CSS properties list! respect those same conventions) where any type of "enumerating stuff" shouldn't end with a comma as that results in syntax error or parsing error?
It's not a syntax error in Java (although it used to be at some point in now ancient implementations), JavaScript (unless you still need <=IE8), C#, Python, Ruby, Perl, PHP, etc. And of course it's not a syntax error in Lua either.

If I'm not mistaken, C89 and C++11 allow for it too. Why older C++ wouldn't… I have no idea.

Quote:
Originally Posted by pazos View Post
We can argue that braces are not needed in this particular example, like the comma in your sample case.
Yup, I'm always annoyed when I come across if statements without curly braces. Not because they are necessary as written because obviously they're not right there and then, but because I have to go about adding braces first instead of just quickly adding whatever I want to add.

Besides avoiding some hopefully minor annoyance (although with curly braces you can get undetected wrong behavior), both curly braces and trailing commas have the diff issue, in that you get some useless noise in your diffs. Again not a big deal, but still a minor annoyance that's nicer to do without.

So:

1. Fewer unintended errors, whether benign (syntax) or harmful (behavior).
2. Cleaner diffs.
3. Less effort. You could see this as a restatement of 1 and 2, but not exactly. I think I'm fairly safe these days from harmful errors introduced by 1 (through bad experience!), but I'm still annoyed at the minor effort of having to add braces or commas. You could also sort the list alphabetically using your editor if desired without running into 1, so I think it's worth making it a separate point.

Therefore languages that don't allow for trailing commas slightly annoy me.

CSS is a bit different though, depending on the specifics. I'm not generally annoyed by it.

Quote:
Originally Posted by shamanNS View Post
I personally hate people that are omitting curly braces for single statement if/else blocks just as much as I hate people that are omitting parentheses when assigning "arrow functions" that take only one argument to a variable or a constant (even though that particular case is mainly "just" offence in regards to code readability /glanceability
I think it's fine (for readability, anyway) if it's indented properly. To take the code from above:

Code:
if(something)
  return true;
else
  return false;
However, the problem now becomes that the indentation is misleading.

Code:
if(something)
  bla;
  // this is always executed
  blabla;
In that sense the way Python works is nice, although mostly it annoys me. I really like being able to do something like:

Code:
if (something) {
  indented();
quick_debug();
  indented_orig();
}
I think that makes it easier to work with.

tl;dr I prefer Lua over Python in many ways even though they seem superficially similar, and this is one of them.

Last edited by Frenzie; 06-11-2019 at 11:17 AM.
Frenzie is offline   Reply With Quote
Reply

Tags
application, k5 tools, kindle, launcher add-ons, lua, reader, touch

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) hawhill Kindle Developer's Corner 1136 Yesterday 06:33 AM
PocketBook-KOReader: a document reader for PDF, DJVU, EPUB, FB2, CBZ, ... (AGPLv3) chrox KOReader 192 07-18-2019 10:25 AM
KPV: a PDF reader for Kindle, based on muPDF, GPLv3 hawhill Kindle Developer's Corner 1056 11-11-2017 03:07 AM
Hacked Up Reader for epub/fb2/txt/rtf/html/pdb/etc bhaak Kindle Developer's Corner 296 10-01-2016 01:11 PM
A real PDF to epub/djvu/rtf/html software?. DsOft ePub 35 01-02-2011 03:57 PM


All times are GMT -4. The time now is 12:56 AM.


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