ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2

ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2 I'm pleased to announce the first public release of the Haskell Pdf Presenter (hpdfp). Project home page: http://michaeldadams.org/projects/haskell-pdf-presenter/ Project on Hackage: http://hackage.haskell.org/package/haskell-pdf-presenter/ Project repository: http://michaeldadams.org/repos-pub/hg/haskell-pdf-presenter/ What it is ========== The Haskell Pdf Presenter (hpdfp) is a tool for presenting PDF-based slide shows. For example, as a presenter, I like to see the next slide before it is shown to the audience as well as how much allotted time remains. I was never quite satisfied with the existing tools for this, so I wrote my own and hpdfp is the result. Though I originally wrote it for my own use, the tool has matured over time, and I now wish to share it with others. Aside from being a useful tool, I think hpdfp is a good example of elegance and economy in program design. Despite being only a thousand lines long, this program is full of features that may not be obvious at first glance so please be sure to look at the available help. Status ====== I've been using this tool in my own talks for over a year now, and it is fairly stable and feature complete. I've only tested it on Ubuntu so I don't know if it ports to other platforms. I'd love to hear any field reports about how it runs on other platforms. Future Directions ================= I have a long TODO list of ideas I may implement in the future, but most development has been driven by the practical considerations that I discover as I use the tool. If you have a use case for a particular feature, please let me know. ================ Feature requests, bug reports, suggestions or feedback as well as contributions to the documentation or implementation are most welcome. Michael D. Adams

That is great, I've been interested in that program since your POPL talk. One problem I've had with it so far: It takes 100% CPU time when idle, which makes my laptop go quite hot. Any idea why that could be? On Wed 13 Nov 2013 18:16:48 GMT, Michael D. Adams wrote:
ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
I'm pleased to announce the first public release of the Haskell Pdf Presenter (hpdfp).
Project home page: http://michaeldadams.org/projects/haskell-pdf-presenter/
Project on Hackage: http://hackage.haskell.org/package/haskell-pdf-presenter/
Project repository: http://michaeldadams.org/repos-pub/hg/haskell-pdf-presenter/
What it is ========== The Haskell Pdf Presenter (hpdfp) is a tool for presenting PDF-based slide shows. For example, as a presenter, I like to see the next slide before it is shown to the audience as well as how much allotted time remains. I was never quite satisfied with the existing tools for this, so I wrote my own and hpdfp is the result.
Though I originally wrote it for my own use, the tool has matured over time, and I now wish to share it with others. Aside from being a useful tool, I think hpdfp is a good example of elegance and economy in program design. Despite being only a thousand lines long, this program is full of features that may not be obvious at first glance so please be sure to look at the available help.
Status ====== I've been using this tool in my own talks for over a year now, and it is fairly stable and feature complete. I've only tested it on Ubuntu so I don't know if it ports to other platforms. I'd love to hear any field reports about how it runs on other platforms.
Future Directions ================= I have a long TODO list of ideas I may implement in the future, but most development has been driven by the practical considerations that I discover as I use the tool. If you have a use case for a particular feature, please let me know.
================
Feature requests, bug reports, suggestions or feedback as well as contributions to the documentation or implementation are most welcome.
Michael D. Adams _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

When the program is doing background rendering, it will go to 100% CPU
time, but once the background rendering completes, it should settle
down to almost no CPU usage at all (my task manager literally shows 0%
CPU once pre-rending completes).
Does this high CPU usage happen even when you don't load a PDF?
After loading a PDF, there will be a small progress bar that races
across the bottom of the presenter window. This represents the
pre-rendering process. Does the CPU usage lower after that process
completes? (If you need to run the experiment a few times, note that
pressing Ctrl-R will flush the cache and re-trigger pre-rending.)
If what you are seeing isn't just the background rendering, then the
first place I would look is to see if the render thread is properly
switching from renderThreadSoon (which burns up CPU) to
renderThreadDelayed (which has a 100ms delay to avoid burning up CPU).
You might also try changing the 100ms delay in renderThreadDelayed
(HaskellPdfPresenter.hs line 932) to something larger like 1000ms.
What operating system, compiler and package versions are you using?
If you have any other clues, figure out what is going on, or if there
is any way I can help you solve this, please let me know.
On Wed, Nov 13, 2013 at 1:57 PM, Niklas Hambüchen
That is great, I've been interested in that program since your POPL talk.
One problem I've had with it so far: It takes 100% CPU time when idle, which makes my laptop go quite hot. Any idea why that could be?
On Wed 13 Nov 2013 18:16:48 GMT, Michael D. Adams wrote:
ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
I'm pleased to announce the first public release of the Haskell Pdf Presenter (hpdfp).
Project home page: http://michaeldadams.org/projects/haskell-pdf-presenter/
Project on Hackage: http://hackage.haskell.org/package/haskell-pdf-presenter/
Project repository: http://michaeldadams.org/repos-pub/hg/haskell-pdf-presenter/
What it is ========== The Haskell Pdf Presenter (hpdfp) is a tool for presenting PDF-based slide shows. For example, as a presenter, I like to see the next slide before it is shown to the audience as well as how much allotted time remains. I was never quite satisfied with the existing tools for this, so I wrote my own and hpdfp is the result.
Though I originally wrote it for my own use, the tool has matured over time, and I now wish to share it with others. Aside from being a useful tool, I think hpdfp is a good example of elegance and economy in program design. Despite being only a thousand lines long, this program is full of features that may not be obvious at first glance so please be sure to look at the available help.
Status ====== I've been using this tool in my own talks for over a year now, and it is fairly stable and feature complete. I've only tested it on Ubuntu so I don't know if it ports to other platforms. I'd love to hear any field reports about how it runs on other platforms.
Future Directions ================= I have a long TODO list of ideas I may implement in the future, but most development has been driven by the practical considerations that I discover as I use the tool. If you have a use case for a particular feature, please let me know.
================
Feature requests, bug reports, suggestions or feedback as well as contributions to the documentation or implementation are most welcome.
Michael D. Adams _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 14/11/13 08:14, Michael D. Adams wrote:
When the program is doing background rendering, it will go to 100% CPU time, but once the background rendering completes, it should settle down to almost no CPU usage at all (my task manager literally shows 0% CPU once pre-rending completes).
Does this high CPU usage happen even when you don't load a PDF?
After loading a PDF, there will be a small progress bar that races across the bottom of the presenter window. This represents the pre-rendering process. Does the CPU usage lower after that process completes? (If you need to run the experiment a few times, note that pressing Ctrl-R will flush the cache and re-trigger pre-rending.)
You are right, it is the background rendering. I accidentally re-triggered it multiple times by re-sizing the window. Thanks for your explanation!

ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
could you explain how you compile this? (what compiler, what version of base, etc.) For me, it does not work with ghc-7.6.3 (binary package) because gtk2hs does not work hackage version (0.12.4) does not work because of /tmp/gtk-0.12.4-7461/gtk-0.12.4/SetupWrapper.hs:94:45: Ambiguous occurrence `moreRecentFile' and darcs version (0.12.4.1) breaks with Graphics/UI/Gtk/Printing/PrintOperation.chs:409:6: Couldn't match expected type `Ptr ()' with actual type `Window' and it also does not work with ghc/fedora (distro package) 7.4.2 HaskellPdfPresenter.hs:901:10: Ambiguous occurrence `catch' It could refer to either `Prelude.catch', imported from `Prelude' at HaskellPdfPresenter.hs:1:1 (and originally defined in `System.IO.Error') or `Control.Exception.catch', - J.W.

I am compiling with GHC 7.6.1 (Ubuntu), Base 4.6.0.0, Cabal 1.16, glib
0.12.4, poppler 0.12.2.2, gtk 0.12.4, cairo 0.12.4 (all from Hackage).
The Hackage version of glib, etc. do not work with Cabal 1.18 due it
adding 'moreRecentFile' to the API. However, it does seem to work if
you downgrade the Cabal package to 1.16. It is any easy fix to rename
the function to avoid the conflict, so I'm not sure why the package
maintainers for glib, etc. haven't already done that.
If you make the following change does hpdfp build with ghc/fedora
(distro package) 7.4.2? (If so, I'll upload a new version of the
package with the patch.)
--- a/HaskellPdfPresenter.hs Wed Nov 13 12:11:26 2013 -0600
+++ b/HaskellPdfPresenter.hs Thu Nov 14 02:22:57 2013 -0600
@@ -898,7 +898,7 @@
-- Load a new PDF document
openDoc state uri = do
- doc <- catch (documentNewFromFile uri Nothing)
+ doc <- Control.Exception.catch (documentNewFromFile uri Nothing) --
Explicit modules to avoid ambiguity in GHC 7.4
(\x -> errorDialog ("Error opening \"" ++ uri ++ "\": " ++
show (x :: GError)) >> return Nothing)
case doc of
Nothing -> errorDialog ("Unknown error opening \"" ++ uri ++
"\"") >> return True
On Wed, Nov 13, 2013 at 4:47 PM, Johannes Waldmann
ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
could you explain how you compile this? (what compiler, what version of base, etc.)
For me, it does not work with ghc-7.6.3 (binary package) because gtk2hs does not work hackage version (0.12.4) does not work because of /tmp/gtk-0.12.4-7461/gtk-0.12.4/SetupWrapper.hs:94:45: Ambiguous occurrence `moreRecentFile' and darcs version (0.12.4.1) breaks with Graphics/UI/Gtk/Printing/PrintOperation.chs:409:6: Couldn't match expected type `Ptr ()' with actual type `Window'
and it also does not work with ghc/fedora (distro package) 7.4.2 HaskellPdfPresenter.hs:901:10: Ambiguous occurrence `catch' It could refer to either `Prelude.catch', imported from `Prelude' at HaskellPdfPresenter.hs:1:1 (and originally defined in `System.IO.Error') or `Control.Exception.catch',
- J.W.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I have published a new version (0.2.3) to Hackage that should fix this
build error.
On Thu, Nov 14, 2013 at 2:29 AM, Michael D. Adams
I am compiling with GHC 7.6.1 (Ubuntu), Base 4.6.0.0, Cabal 1.16, glib 0.12.4, poppler 0.12.2.2, gtk 0.12.4, cairo 0.12.4 (all from Hackage).
The Hackage version of glib, etc. do not work with Cabal 1.18 due it adding 'moreRecentFile' to the API. However, it does seem to work if you downgrade the Cabal package to 1.16. It is any easy fix to rename the function to avoid the conflict, so I'm not sure why the package maintainers for glib, etc. haven't already done that.
If you make the following change does hpdfp build with ghc/fedora (distro package) 7.4.2? (If so, I'll upload a new version of the package with the patch.)
--- a/HaskellPdfPresenter.hs Wed Nov 13 12:11:26 2013 -0600 +++ b/HaskellPdfPresenter.hs Thu Nov 14 02:22:57 2013 -0600 @@ -898,7 +898,7 @@
-- Load a new PDF document openDoc state uri = do - doc <- catch (documentNewFromFile uri Nothing) + doc <- Control.Exception.catch (documentNewFromFile uri Nothing) -- Explicit modules to avoid ambiguity in GHC 7.4 (\x -> errorDialog ("Error opening \"" ++ uri ++ "\": " ++ show (x :: GError)) >> return Nothing) case doc of Nothing -> errorDialog ("Unknown error opening \"" ++ uri ++ "\"") >> return True
On Wed, Nov 13, 2013 at 4:47 PM, Johannes Waldmann
wrote: ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
could you explain how you compile this? (what compiler, what version of base, etc.)
For me, it does not work with ghc-7.6.3 (binary package) because gtk2hs does not work hackage version (0.12.4) does not work because of /tmp/gtk-0.12.4-7461/gtk-0.12.4/SetupWrapper.hs:94:45: Ambiguous occurrence `moreRecentFile' and darcs version (0.12.4.1) breaks with Graphics/UI/Gtk/Printing/PrintOperation.chs:409:6: Couldn't match expected type `Ptr ()' with actual type `Window'
and it also does not work with ghc/fedora (distro package) 7.4.2 HaskellPdfPresenter.hs:901:10: Ambiguous occurrence `catch' It could refer to either `Prelude.catch', imported from `Prelude' at HaskellPdfPresenter.hs:1:1 (and originally defined in `System.IO.Error') or `Control.Exception.catch',
- J.W.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 13/11/13 22:47, Johannes Waldmann wrote:
ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
could you explain how you compile this? (what compiler, what version of base, etc.)
I managed to install it with a plain `cabal install`. I used the GHC binaries from the web site and no Haskell Platform installed.

Apparently the following command gets around these build problems
(provided of course that you have Cabal 1.16 installed).
cabal install --cabal-lib-version=1.16.0 poppler
I haven't tested it personally, but thought I'd pass it on.
On Thu, Nov 14, 2013 at 8:52 AM, Niklas Hambüchen
On 13/11/13 22:47, Johannes Waldmann wrote:
ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2
could you explain how you compile this? (what compiler, what version of base, etc.)
I managed to install it with a plain `cabal install`. I used the GHC binaries from the web site and no Haskell Platform installed. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Johannes Waldmann
-
Michael D. Adams
-
Niklas Hambüchen