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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-07-2012, 11:06 AM   #31
J.C.
Addict
J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.
 
Posts: 215
Karma: 3184
Join Date: Feb 2011
Device: PB602, Palm TX
I doubt a script in a zipped file got converted, auto conversion is usually done on text file when using ftp, if you used ftp along the way to get the file where it is rkomar you might want to look into it.
Broadly speaking the only cases for auto-conversion I ever encountered were ftp transfers and text editors.

Edit: I've checked and the file in the zip is definitely in unix format, so the most likely culprit is the text editor paola used.

Last edited by J.C.; 01-07-2012 at 11:10 AM.
J.C. is offline   Reply With Quote
Old 01-07-2012, 12:55 PM   #32
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by J.C. View Post
I doubt a script in a zipped file got converted, auto conversion is usually done on text file when using ftp, if you used ftp along the way to get the file where it is rkomar you might want to look into it.
Broadly speaking the only cases for auto-conversion I ever encountered were ftp transfers and text editors.

Edit: I've checked and the file in the zip is definitely in unix format, so the most likely culprit is the text editor paola used.
I didn't think of the ftp transfer up to my site as being the culprit. I've just checked, and the files on the site are exactly the same size as those they mirror on my computer, so I think that part is okay. Still, it was worth verifying. I've been using lftp and its mirror command for that; very handy.

It would be great to be able to download directly onto the ereader, but the browser on my 902 doesn't seem to allow that. Too bad!
rkomar is online now   Reply With Quote
 
Enthusiast
Old 01-07-2012, 01:25 PM   #33
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by bense2k View Post
Would it be possible to add a progressbar? Would be practical for download scripts.
I'm not sure how well it would work, but such a thing is possible on the Inkview side. There is a Progressbar dialog. To update it, the program needs to regularly make calls to a function that takes the percentage completed as an argument. I suppose it could be set up so that the sh_ivtool app would just read the percentage from an external file whenever it changed and update the progress bar until 100% is reached. The difficulty is in writing that percentage to the file on the download app side. I think you can strip the percentage out from wget's output, but it takes some work (for example: http://fitnr.com/showing-file-downlo...sing-wget.html)

It might make more sense to just write an application that takes a URL and target filename as arguments and calls DownloadTo(), assuming that that automatically does the progress bar for you. In fact, such a program would come in handy for downloading the epub-edit.app we've been discussing directly to the ereader. I'll see if I can quickly bang something out for that.
rkomar is online now   Reply With Quote
Old 01-07-2012, 03:44 PM   #34
bense2k
Member
bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'bense2k knows the difference between 'who' and 'whom'
 
Posts: 14
Karma: 10316
Join Date: Feb 2011
Device: Pocketbook pro 602
@rkomar
I meant it for scripts were you download more then one file, like an rss downloader.
For example you download 10 files and the Progressbar adds 10% for each downloaded file.

A menu system like in dialog on a regular shell woud be nice to.
bense2k is offline   Reply With Quote
Old 01-07-2012, 03:45 PM   #35
paola
Wizard
paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.
 
paola's Avatar
 
Posts: 2,625
Karma: 4114560
Join Date: Oct 2010
Location: UK
Device: Pocketbook Pro 903, (beloved Pocketbook 360 RIP), Kobo Mini
Quote:
Originally Posted by J.C. View Post
I doubt a script in a zipped file got converted, auto conversion is usually done on text file when using ftp, if you used ftp along the way to get the file where it is rkomar you might want to look into it.
Broadly speaking the only cases for auto-conversion I ever encountered were ftp transfers and text editors.

Edit: I've checked and the file in the zip is definitely in unix format, so the most likely culprit is the text editor paola used.
well, I unzipped the file directly on the device, and it did not work. I've double checked now, and while the edit-epub.app file saved from the webpage goes all in one line in notepad, the unzipped file looks like a normal text file for windows - could the unzipping be creating the problem? Or it could be that the issue was the unzipping with a windows programme directly onto a linux system?
paola is offline   Reply With Quote
Old 01-07-2012, 06:15 PM   #36
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by paola View Post
well, I unzipped the file directly on the device, and it did not work. I've double checked now, and while the edit-epub.app file saved from the webpage goes all in one line in notepad, the unzipped file looks like a normal text file for windows - could the unzipping be creating the problem? Or it could be that the issue was the unzipping with a windows programme directly onto a linux system?
It sounds like your unzipping program is automatically inserting the extra carriage return characters in the output file. What are you using to do the unzipping? If you have poterm on your reader, then you can use your copy of /mnt/ext1/system/bin/unzip on the zip file (the copy in /bin/unzip just produces an error when you try to unzip to /mnt/ext1 or /mnt/ext2).
rkomar is online now   Reply With Quote
Old 01-07-2012, 06:23 PM   #37
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by bense2k View Post
@rkomar
I meant it for scripts were you download more then one file, like an rss downloader.
For example you download 10 files and the Progressbar adds 10% for each downloaded file.

A menu system like in dialog on a regular shell woud be nice to.
I see. In that case, it wouldn't be too hard to get such a progress bar working. It would be up to the script to update a file with the current percentage, and that file would be read by sh_ivtool and the progress bar updated until the file is deleted.

I'm not sure what you mean by a menu system. I just added @bogomil's code for displaying multiple options in a dialog yesterday. Would that be what you're looking for?
rkomar is online now   Reply With Quote
Old 01-08-2012, 04:17 AM   #38
paola
Wizard
paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.
 
paola's Avatar
 
Posts: 2,625
Karma: 4114560
Join Date: Oct 2010
Location: UK
Device: Pocketbook Pro 903, (beloved Pocketbook 360 RIP), Kobo Mini
Quote:
Originally Posted by rkomar View Post
It sounds like your unzipping program is automatically inserting the extra carriage return characters in the output file. What are you using to do the unzipping? If you have poterm on your reader, then you can use your copy of /mnt/ext1/system/bin/unzip on the zip file (the copy in /bin/unzip just produces an error when you try to unzip to /mnt/ext1 or /mnt/ext2).
as for unzipping, I think it is some kind of windows application that is part of the OS - I'll check better.

As for poterm - yesterday for the first time I started seriously considering installing it, as in addition my laptop has not been "recognisign"the ereader when connecting via USB. I am somewhat daunted by the process, but I'll get there eventually
paola is offline   Reply With Quote
Old 01-08-2012, 06:21 AM   #39
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by paola View Post
as for unzipping, I think it is some kind of windows application that is part of the OS - I'll check better.

As for poterm - yesterday for the first time I started seriously considering installing it, as in addition my laptop has not been "recognisign"the ereader when connecting via USB. I am somewhat daunted by the process, but I'll get there eventually
If the unzipping program is part of the OS, then all the more reason to assume others will have the same problem. I thought zipping the script would help avoid the conversion problem, but it looks like it happens during unzipping, too. So, I'll delete the zip file from the website, as it isn't helping in any way and just confusing things.

Installing poterm is easy, but using it is the hard part, in that you have to learn the Unix shell commands for it.

Last edited by rkomar; 01-08-2012 at 06:24 AM.
rkomar is online now   Reply With Quote
Old 01-08-2012, 06:41 AM   #40
paola
Wizard
paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.
 
paola's Avatar
 
Posts: 2,625
Karma: 4114560
Join Date: Oct 2010
Location: UK
Device: Pocketbook Pro 903, (beloved Pocketbook 360 RIP), Kobo Mini
Quote:
Originally Posted by rkomar View Post
Installing poterm is easy, but using it is the hard part, in that you have to learn the Unix shell commands for it.
Thanks Rob - I'm old enogh to have been using dos in the olden days, when yong and enthusiatic and before deciding that life was too short for IT proficiency so at least I am not totally frightened by the prospect!
I am happy to give it a go to - to these look like reasonable places to start?
http://freeengineer.org/learnUNIXin10minutes.html
https://supportweb.cs.bham.ac.uk/doc...scripting.html
paola is offline   Reply With Quote
Old 01-08-2012, 04:34 PM   #41
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by paola View Post
Thanks Rob - I'm old enogh to have been using dos in the olden days, when yong and enthusiatic and before deciding that life was too short for IT proficiency so at least I am not totally frightened by the prospect!
I am happy to give it a go to - to these look like reasonable places to start?
http://freeengineer.org/learnUNIXin10minutes.html
https://supportweb.cs.bham.ac.uk/doc...scripting.html
They both look to be pretty good; the first as a reference for using the shell and the second as a tutorial for writing scripts. The traditional resource for information on Unix systems is the "man" pages (i.e. manual), but they aren't installed on the PocketBook devices. If you google the command name and 'man' together, you'll likely find a copy of the man page for that command. The pages are pretty technical, but definitive. So, your first link is a great way to find out the name of the command that should be used to do something, and then you can look at the man page if you want to know more about that command.

Bear in mind that poterm doesn't really have a proper terminal, so the more complicated stuff that manipulates the screen (like using an editor) doesn't really work there. But it is fine for quick commands like copying or moving files around, showing file contents,...

It's not for everyone, but having shell access is a great way to see into the "black box" of the ereader. They really are full blown computers.
rkomar is online now   Reply With Quote
Old 01-08-2012, 05:14 PM   #42
paola
Wizard
paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.paola ought to be getting tired of karma fortunes by now.
 
paola's Avatar
 
Posts: 2,625
Karma: 4114560
Join Date: Oct 2010
Location: UK
Device: Pocketbook Pro 903, (beloved Pocketbook 360 RIP), Kobo Mini
thanks: slowly but surely, I'll give it a go!
paola is offline   Reply With Quote
Old 01-10-2012, 06:49 AM   #43
bogomil
Member
bogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterbogomil can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 21
Karma: 12650
Join Date: Apr 2011
Device: PB903
I am trying to introduce a new option -v for viewing a file in the tool but face the following problem: there are some characters after the end of the line - see below:


The code:

Code:
void choose_line(){
  int i=0,j=0;
  char* p=NULL;
	toc = (tocentry*)malloc(1024*sizeof(tocentry));
  
  FILE* pInFile = fopen (path, "rt");
  char strLine [1024]; // if your file has longer lines, make it bigger
  
  if (pInFile) {
    while ((p=fgets(strLine, sizeof (strLine), pInFile))) {
      
      // Remove trailing ' '
      for(;j<strlen(strLine) && p[j]==' ';j++) p+=1;
      
  		toc[i].level = 1;
  		toc[i].page = 0;
  		toc[i].position = i;
  		toc[i].text = strdup(p);

  		toc[i+1].level = 2;
  		toc[i+1].page = 0;
  		toc[i+1].position = i+1;
  		toc[i+1].text = strdup("next level");
  		i+=2;
    }
    fclose (pInFile);
    numfiles=i;
  }
  
	OpenContents(toc, i, 0, fileselect_handler);
}
Any ideas what is wrong?
Attached Files
File Type: zip main.c.zip (2.9 KB, 58 views)

Last edited by bogomil; 01-10-2012 at 06:52 AM.
bogomil is offline   Reply With Quote
Old 01-10-2012, 10:40 AM   #44
J.C.
Addict
J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.J.C. could sell banana peel slippers to a Deveel.
 
Posts: 215
Karma: 3184
Join Date: Feb 2011
Device: PB602, Palm TX
Without consulting a C reference I'd say that if you're assuming that every line is the same size you might be displaying an area in memory that you allocated for the line but didn't fill when you read it.
J.C. is offline   Reply With Quote
Old 01-10-2012, 12:16 PM   #45
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,508
Karma: 4065128
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
@bogomil

That for loop looks like it is really for removing spaces from the beginning of the line rather than the trailing spaces as the comment says. The problem with it is that the index variable j is never reset for the next line. So, putting the initializer j=0 into the for loop should fix that. Personally, I would have just used a while loop for this:
Code:
while (*p == ' ') p++;
Also, fgets keeps the newline character at the end of the string. Maybe that's what's causing the strange characters to appear in the contents. You should strip it off the back of the string if it is there.

Finally, it's worth checking to see if i>0 before calling OpenContents, otherwise it hangs the program if there are no lines to show.

Edit: I forgot to add that files with more that 512 lines are going to start corrupting your program, because you will be writing past the end of toc. You need to realloc more space before then.

Last edited by rkomar; 01-10-2012 at 12:23 PM.
rkomar is online now   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
Trio of Picture Books - Simple Animals, Simple Shapes, and You're My Baby! Manley Peterson Self-Promotions by Authors and Publishers 5 01-06-2012 08:55 PM
Application update: application not installed error Merischino Kindle Fire 4 12-01-2011 10:30 PM
erm, simple question , hope for simple answer! al zymers Amazon Kindle 5 09-25-2010 01:01 PM
Simple question for a simple mind :) PKFFW OpenInkpot 6 08-27-2009 09:00 PM
Television scripts for your handheld Bob Russell Lounge 2 01-07-2006 06:22 PM


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


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