Re: [racket-users] running tests with different #langs

2018-03-23 Thread Vincent St-Amour
The typed versions of the "common" Scheme benchmarks do something similar:


https://github.com/racket/racket/blob/master/pkgs/racket-benchmarks/tests/racket/benchmarks/common/typed/wrapper.rkt

Vincent



On Fri, 23 Mar 2018 16:15:01 -0500,
Stephen Chang wrote:
> 
> I frequently want to run the same tests with different #lang's.
> 
> Has anyone written a test harness that lets me do this without
> duplicating the test code? (I couldnt find anything on the pkg
> server.)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-23 Thread Sanjeev Sharma
I've done no math in 20 years - used to do tons (with the not so great 
graphics of the time) saw this intriguing plot & banged my head against a 
wall for a couple of hours.

Then I just settled down & read the manual systematically, pretending it 
may have some info,  followed the examples and voila

(require plot)(plot-new-window? #t)
(define(xu u)(*(sin(* 33 u))(cos(* 9 u
(define(yu u)(*(sin(* 49 u))(sin(* 7 u
(plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] running tests with different #langs

2018-03-23 Thread Stephen Chang
I frequently want to run the same tests with different #lang's.

Has anyone written a test harness that lets me do this without
duplicating the test code? (I couldnt find anything on the pkg
server.)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Joel Dueck
OK, I am a bit of an idiot, but in case someone else reads this thread 
looking for answers, here are the resolutions I've chased down so far.

1. **I did not read the docs for pdf-read well enough** because right there 
at the top of the main page, it says it only works on Linux and macOS. 
*facepalm*

2. When I initially had the problem with pdf-read on Windows, I incorrectly 
thought that pdf-read needed me to install the racket-poppler package in 
order to work.

3. I did not realize that racket-poppler and pdf-read were completely 
independent of each other, and that racket-poppler on its own provides 
roughly everything that pdf-read does.

4. By using racket-poppler I can get a *little* closer:
#lang racket
(require racket-poppler)

   → 
AppData\Roaming\Racket\6.12\pkgs\racket-poppler\racket-poppler\ffi.rkt:99:0: 
ffi-obj: couldn't get "g_filename_to_uri" from "C:\\Program 
Files\\Racket\\lib\\libglib-2.0-0.dll" (The specified procedure could not 
be found.; errid=127)

5. I have the growing sense that it's probably better, in this case, to 
roll my own functions rather than risk hassles for Windows users (not that 
I'm any fan of Windows). I've learned a lot, though!

6. So, nudged by Neil's reply above, I went ahead and wrote my own 
super-lazy functions to do what I need for now. Here they are:

(define (page-count pdf-filename)
  (define pdf (open-input-file pdf-filename))
  
  (for/sum ([line (in-port read-line pdf)])
(let ([x (regexp-match #px"/Type[\\s]*/Page[^s]" line)])
  (if x (count values x) 0

; Look for first occurrence of the form "/MediaBox [0 0 612.0 792.0]" - 
Returns the width and height of the box, or #f
(define (has-media-box? str)
  (define mediabox-px 
#px"/MediaBox\\s*\\[\\s*([0-9\\.])+\\s+([0-9\\.])+\\s+([0-9\\.]+)\\s+([0-9\\.]+)\\s*\\]")
  (let* ([x (regexp-match mediabox-px str)])
(cond
  [x
   (match-let ([(list start-x start-y end-x end-y) (map string->number 
(rest x))])
 (list (- end-x start-x) (- end-y start-y)))]
  [else #f])))

(define (pagesize pdf-filename)
  (define pdf (open-input-file pdf-filename))

  (for/last ([line (stop-after (in-port read-line pdf) has-media-box?)])
(has-media-box? line)))

I can already think of a few cases where these would return inaccurate 
results (unlinked page objects, varying page sizes, etc). But they are 
reasonably fast and have worked correctly on the dozen or so test PDFs I've 
thrown at them.

8. Thank you all for helping and putting up with me.

—Joel D.

On Friday, March 23, 2018 at 12:50:41 PM UTC-5, Matthew Flatt wrote:
>
> At Fri, 23 Mar 2018 09:39:41 -0700 (PDT), Joel Dueck wrote: 
> > On Friday, March 23, 2018 at 9:16:55 AM UTC-5, Greg Trzeciak wrote: 
> > > 
> > > So it's clear it's not the path issue, see neighbouring thread on 
> another 
> > > possibility - some dependency of libpoppler is missing on Windows 
> > > 
> > > 
> >  Ok, I tried Dependency Walker on libpoppler-glib-8.dll, and got all 
> kinds 
> > of missing dependencies. 
> > 
> > Mostly of the form API-MS-WIN-CORE-PROFILE-L1-1-0.DLL 
>
> You can ignore anything under the system DLLs like "kernel32.dll". 
>
>
> Are you using "racket-poppler/ffi.rkt" to load the DLLs, or are you 
> loading the DLL yourself? If you're not using "racket-poppler/ffi.rkt", 
> then you'll need to do something like the way it explicitly loads all 
> of the dependencies of a DLL before loading a DLL: 
>
>
> https://github.com/soegaard/racket-poppler/blob/master/racket-poppler/ffi.rkt#L34
>  
>
> I think "libgobject-2.0-0.dll" is missing there, but it gets loaded 
> anyway by `racket/draw/unsafe/glib`. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Splitting up a GUI source file?

2018-03-23 Thread James Platt

> May be relevant
> 
> https://pkgs.racket-lang.org/package/spreadsheet-editor

Indeed, I got part way through working with that package for this exact purpose 
but ran into glitches.  The main thing is just a lack of documentation.  At 
this point, I am favoring the idea of borrowing qresults-list% from the 
Activity Log2 application as mentioned previously on this list (quoted below.)  
Unfortunately, I probably won't have time to get back to the project until May.

On Mar 5, 2018, at 4:00 PM, Alex Harsanyi wrote:

> If you want to look at a possible implementation, I wrote a wrapper around 
> list-box% for exactly the purpose of showing SQL query results in a 
> list-box%.  It supports sorting, adding, deleting and updating individual 
> rows, and you can also reorder and resize columns and this layout is saved 
> and can be restored:
> 
>https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets.rkt#L982
> 
> The name of the class is `qresults-list%` and you can find usage examples of 
> it throughout the application.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Matthew Flatt
At Fri, 23 Mar 2018 09:39:41 -0700 (PDT), Joel Dueck wrote:
> On Friday, March 23, 2018 at 9:16:55 AM UTC-5, Greg Trzeciak wrote:
> >
> > So it's clear it's not the path issue, see neighbouring thread on another 
> > possibility - some dependency of libpoppler is missing on Windows
> >
> >
>  Ok, I tried Dependency Walker on libpoppler-glib-8.dll, and got all kinds 
> of missing dependencies.
> 
> Mostly of the form API-MS-WIN-CORE-PROFILE-L1-1-0.DLL

You can ignore anything under the system DLLs like "kernel32.dll".


Are you using "racket-poppler/ffi.rkt" to load the DLLs, or are you
loading the DLL yourself? If you're not using "racket-poppler/ffi.rkt",
then you'll need to do something like the way it explicitly loads all
of the dependencies of a DLL before loading a DLL:

https://github.com/soegaard/racket-poppler/blob/master/racket-poppler/ffi.rkt#L34

I think "libgobject-2.0-0.dll" is missing there, but it gets loaded
anyway by `racket/draw/unsafe/glib`.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Splitting up a GUI source file?

2018-03-23 Thread Stephen De Gabrielle
May be relevant

https://pkgs.racket-lang.org/package/spreadsheet-editor

s.

On Fri, Mar 23, 2018 at 5:09 PM, James Platt  wrote:

>
> > I am trying to create a GUI program, my problem is that the source code
> for the
> > GUI portion is growing out of control and I don't know how to split it
> up.
>
> I'm not sure if this will really answer your question but you may want to
> look at some code from MrEd Designer and see how it splits stuff up.  It
> generates all the GUI code in a file which you then include in a file with
> the logic you write.  Following this approach, you could probably have more
> than one GUI file which you could include in your top level file.
>
> >
> > Here is some background info: the GUI is basically just a specialised
> frontend
> > to a database, the users clicks some stuff, the corresponding query is
> > constructed and sent off to SQLite using the db library.
>
> Actually, I've been thinking about learning about how to create MrEd
> Designer widgets in order to add some elements which would be useful for
> database clients.  This would include editable tables, like you mention.
>
> James
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Splitting up a GUI source file?

2018-03-23 Thread Matthias Felleisen


SHORT: You may wish to *look* at the first units paper at 

   https://www2.ccs.neu.edu/racket/pubs/#pldi98-ff
 
because what you describe is almost exactly the example from that paper. 
Just read the example section. If you like what you see, jump into the
docs. 

;; - - - 

SOMEWHAT LONGER: People usually shift a compile-time organization 
to a run-time one when confronted with this situation, that is, 
the desire to split such things in a static, tree-shaped world. 

The code then exports functions that when called with proper 
callbacks create the desired code and perform properly. What 
you give up then, is a compile-time confirmation that these things 
match up. 

Units solve this with support for mutually referential components. 
To some extent they are independent of modules and you can use 
modules with units just fine. 

Historically, units were our first module system but getting syntax
export/imports right is easier with first-order modules. 

— Matthias






> On Mar 23, 2018, at 11:39 AM, HiPhish  wrote:
> 
> Hello Racketeers,
> 
> I am trying to create a GUI program, my problem is that the source code for 
> the
> GUI portion is growing out of control and I don't know how to split it up.
> 
> Here is some background info: the GUI is basically just a specialised frontend
> to a database, the users clicks some stuff, the corresponding query is
> constructed and sent off to SQLite using the db library.
> 
> The layout is to have one main window with a tab view. The application is
> supposed to manage a small library, so each tab shows either the books, the
> users, or the rentals. Here is a simple tree-view of the GUI:
> 
>   main window
>   |
>   |-- main tab view
>   |
>   |-- Books pane
>   |   |
>   |   |- List view of books (a table)
>   |   |- Button to add a new book
>   |   |- Button to remove a book
>   |   |- Button to rent out a book
>   |
>   |-- Users pane
>   |   |
>   |   |- List view of users (a table)
>   |   |- Button to add a new user
>   |   |- Button to remove a user
>   |
>   |-- Rentals pane
>   |
>   |- List current rentals (a table)
>   |- Button to remove a rental
> 
> 
> I might reconsider the rentals part, but that's not relevant at the moment. My
> problem is that even though the three panes don't need to know anything about
> each other, they need to know about their parent (the main tab view), I cannot
> split the code into a module hierarchy like the tree.
> 
>   (define main-window (new frame% [label "Library"]))
>   (define main-tab-view (new tab-panel% [parent main-window]))
> 
>   (define books-panel (new vertical-panel% [parent main-tab-view]))
>   (define books-table (new list-view% [parent books-pane]))
>   (define books-buttons-pane (new horizontal-pane% [parent books-panel]))
>   (define add-button (new button% [parent books-buttons-pane]))
>   (define remove-button (new button% [parent books-buttons-pane]))
>   (define rent-button (new button% [parent books-buttons-pane]))
> 
> 
> And so on. This isn't much code, but add in all the callbacks and events, and
> repeat that for all the three views, and the code quickly starts adding up.
> How should I break it up into smaller modules?
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Greg Trzeciak
hmm... I've tried to see what dependencies would dumpbin show on my machine 
for libpoppler and it fails with "e:\libpoppler-glib-8.dll : warning 
LNK4048: Invalid format file; ignored" so it may be that something is wrong 
with a binary on Windows 10.
Still my previous advice (ignore anything below top level tree) still stands

On Friday, March 23, 2018 at 6:16:02 PM UTC+1, Greg Trzeciak wrote:
>
> That's why I actually prefer dumpbin (see the other thread) from depedency 
> walker - simpler without so many confusing details. 
> But since you probably don't have VS here is my advice: collapse entire 
> result tree from dependency walker - leave only top level libraries to see 
> which ones are missing and ignore the details like API-MS...
>
> On Friday, March 23, 2018 at 5:39:42 PM UTC+1, Joel Dueck wrote:
>>
>> On Friday, March 23, 2018 at 9:16:55 AM UTC-5, Greg Trzeciak wrote:
>>>
>>> So it's clear it's not the path issue, see neighbouring thread on 
>>> another possibility - some dependency of libpoppler is missing on Windows
>>>
>>>
>>  Ok, I tried Dependency Walker on libpoppler-glib-8.dll, and got all 
>> kinds of missing dependencies.
>>
>> Mostly of the form API-MS-WIN-CORE-PROFILE-L1-1-0.DLL
>>
>> I wonder if this is a Windows 10 problem. I probably need to look at 
>> rolling my own flaky PDF functions after all.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Greg Trzeciak
That's why I actually prefer dumpbin (see the other thread) from depedency 
walker - simpler without so many confusing details. 
But since you probably don't have VS here is my advice: collapse entire 
result tree from dependency walker - leave only top level libraries to see 
which ones are missing and ignore the details like API-MS...

On Friday, March 23, 2018 at 5:39:42 PM UTC+1, Joel Dueck wrote:
>
> On Friday, March 23, 2018 at 9:16:55 AM UTC-5, Greg Trzeciak wrote:
>>
>> So it's clear it's not the path issue, see neighbouring thread on another 
>> possibility - some dependency of libpoppler is missing on Windows
>>
>>
>  Ok, I tried Dependency Walker on libpoppler-glib-8.dll, and got all kinds 
> of missing dependencies.
>
> Mostly of the form API-MS-WIN-CORE-PROFILE-L1-1-0.DLL
>
> I wonder if this is a Windows 10 problem. I probably need to look at 
> rolling my own flaky PDF functions after all.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Splitting up a GUI source file?

2018-03-23 Thread James Platt

> I am trying to create a GUI program, my problem is that the source code for 
> the
> GUI portion is growing out of control and I don't know how to split it up.

I'm not sure if this will really answer your question but you may want to look 
at some code from MrEd Designer and see how it splits stuff up.  It generates 
all the GUI code in a file which you then include in a file with the logic you 
write.  Following this approach, you could probably have more than one GUI file 
which you could include in your top level file.  

> 
> Here is some background info: the GUI is basically just a specialised frontend
> to a database, the users clicks some stuff, the corresponding query is
> constructed and sent off to SQLite using the db library.

Actually, I've been thinking about learning about how to create MrEd Designer 
widgets in order to add some elements which would be useful for database 
clients.  This would include editable tables, like you mention.

James

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] error with pdf-read / libpoppler on Windows

2018-03-23 Thread David Storrs
On Thu, Mar 22, 2018 at 6:45 PM, Neil Van Dyke  wrote:

> (Warnings: the PDF documentation is big, you'll appreciate why C and C++
> programmers have difficulty implementing PDF without filling it with
> vulnerabilities, and you'll also get to see some totalitarian-friendly
> features that have been added to PDF.)

Having done exactly this (although in Perl, not C/C++), I can attest
that parsing, modifying, and/or generating arbitrary PDFs is a bloody
nightmare.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Joel Dueck
On Friday, March 23, 2018 at 9:16:55 AM UTC-5, Greg Trzeciak wrote:
>
> So it's clear it's not the path issue, see neighbouring thread on another 
> possibility - some dependency of libpoppler is missing on Windows
>
>
 Ok, I tried Dependency Walker on libpoppler-glib-8.dll, and got all kinds 
of missing dependencies.

Mostly of the form API-MS-WIN-CORE-PROFILE-L1-1-0.DLL

I wonder if this is a Windows 10 problem. I probably need to look at 
rolling my own flaky PDF functions after all.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Splitting up a GUI source file?

2018-03-23 Thread HiPhish
Hello Racketeers,

I am trying to create a GUI program, my problem is that the source code for 
the
GUI portion is growing out of control and I don't know how to split it up.

Here is some background info: the GUI is basically just a specialised 
frontend
to a database, the users clicks some stuff, the corresponding query is
constructed and sent off to SQLite using the db library.

The layout is to have one main window with a tab view. The application is
supposed to manage a small library, so each tab shows either the books, the
users, or the rentals. Here is a simple tree-view of the GUI:

  main window
  |
  |-- main tab view
  |
  |-- Books pane
  |   |
  |   |- List view of books (a table)
  |   |- Button to add a new book
  |   |- Button to remove a book
  |   |- Button to rent out a book
  |
  |-- Users pane
  |   |
  |   |- List view of users (a table)
  |   |- Button to add a new user
  |   |- Button to remove a user
  |
  |-- Rentals pane
  |
  |- List current rentals (a table)
  |- Button to remove a rental


I might reconsider the rentals part, but that's not relevant at the moment. 
My
problem is that even though the three panes don't need to know anything 
about
each other, they need to know about their parent (the main tab view), I 
cannot
split the code into a module hierarchy like the tree.

  (define main-window (new frame% [label "Library"]))
  (define main-tab-view (new tab-panel% [parent main-window]))

  (define books-panel (new vertical-panel% [parent main-tab-view]))
  (define books-table (new list-view% [parent books-pane]))
  (define books-buttons-pane (new horizontal-pane% [parent books-panel]))
  (define add-button (new button% [parent books-buttons-pane]))
  (define remove-button (new button% [parent books-buttons-pane]))
  (define rent-button (new button% [parent books-buttons-pane]))


And so on. This isn't much code, but add in all the callbacks and events, 
and
repeat that for all the three views, and the code quickly starts adding up.
How should I break it up into smaller modules?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Windows Foreign Libraries

2018-03-23 Thread Greg Trzeciak
Another option to check for dependencies (if you have Visual Studio 
installed - VS community edition is free but BULKY) is to run dumpbin from 
console, or better yet VS code since dumpbin is in VS/bin folder.
It is less overwhelming but will check only for one level deep 
dependencies, ie you may need to check for dependencies of dependencies 
individually

Here is an example dump:
C:\Program Files (x86)\Microsoft Visual Studio 14.0>dumpbin /dependents 
e:\RacketProjects\libxslt-ffi\lib\64bit\libxslt-1.dll
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file e:\RacketProjects\libxslt-ffi\lib\64bit\libxslt-1.dll

File Type: DLL

  Image has the following dependencies:

libxml2-2.dll
KERNEL32.dll
msvcrt.dll
libwinpthread-1.dll

  Summary

1000 .CRT
1000 .bss
1000 .data
7000 .debug_abbrev
1000 .debug_aranges
8000 .debug_frame
   71000 .debug_info
C000 .debug_line
   44000 .debug_loc
5000 .debug_ranges
4000 .debug_str
2000 .edata
3000 .idata
2000 .pdata
A000 .rdata
1000 .reloc
   27000 .text
1000 .tls
2000 .xdata

On Friday, March 23, 2018 at 2:52:28 PM UTC+1, Dmitry Pavlov wrote:
>
>
> Second, your dll may refuse to load because some of its dependencies 
> are missing. You may use the freeware Dependency Walker (depends.exe) 
> to find out what is missing. 
>
>
> Regards, 
>
> Dmitry 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Greg Trzeciak
BTW, you can use forward slashes on windows for the path 
"C:/Users/Joel...", I've found it more digestible than "\\"

On Friday, March 23, 2018 at 3:05:07 PM UTC+1, Joel Dueck wrote:
>
>
> ; (B) tried absolute path: 
>(define-ffi-definer define-poppler (ffi-lib 
> "C:\\Users\\Joel\\AppData\\Roaming\\Racket\\6.12\\lib\\libpoppler-glib-8"))
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Greg Trzeciak
So it's clear it's not the path issue, see neighbouring thread on another 
possibility - some dependency of libpoppler is missing on Windows

On Friday, March 23, 2018 at 3:05:07 PM UTC+1, Joel Dueck wrote:
>
> On Thursday, March 22, 2018 at 6:14:59 PM UTC-5, Greg Trzeciak wrote:
>>
>> Last few times I had this error it was one of the following:
>> 1. Incorrect version (32 vs 64bit)
>> 2. Problem with Path.
>>
>> For 2. have you tried setting it up with absolute path to eliminate Path 
>> as a problem?
>>
>
>  The poppler package installed is poppler-win32-x86-64 which matches the 
> 64-bitness of my Racket.
>
> Not sure precisely which mechanism you had in mind for trying number 2. 
> But I tried editing ffi.rkt in the pdf-read package as follows:
>
> ; original: (define-ffi-definer define-poppler (ffi-lib "libpoppler-glib"))
> ; (A) tried adding version: 
> ;  (define-ffi-definer define-poppler (ffi-lib "libpoppler-glib" "8"))
> ; (B) tried absolute path: 
>(define-ffi-definer define-poppler (ffi-lib 
> "C:\\Users\\Joel\\AppData\\Roaming\\Racket\\6.12\\lib\\libpoppler-glib-8"))
>
> Both edits return basically the same error as before:
>
> (A)  ffi-lib: couldn't open "libpoppler-glib-8.dll" (The specified module 
> could not be found.; errid=126)
> (B)  ffi-lib: couldn't open 
> "C:\\Users\\Joel\\AppData\\Roaming\\Racket\\6.12\\lib\\libpoppler-glib-8.dll" 
> (The specified module could not be found.; errid=126)
>
> For testing I did:
>
> #lang racket
>
> (require ffi/unsafe setup/dirs); pdf-read)
>
> (define paths (get-lib-search-dirs))
>
> (define (poppler? path)
>   (string-contains? (path->string path) "poppler-glib"))
>
> (flatten (for/list ([p paths])
>(find-files poppler? p)))
>
> Produces:
>
>
> '(#)
>
> So it should be able to find the dll at least. Perhaps it's just not able 
> to load it for some other reason.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: error with pdf-read / libpoppler on Windows

2018-03-23 Thread Joel Dueck
On Thursday, March 22, 2018 at 6:14:59 PM UTC-5, Greg Trzeciak wrote:
>
> Last few times I had this error it was one of the following:
> 1. Incorrect version (32 vs 64bit)
> 2. Problem with Path.
>
> For 2. have you tried setting it up with absolute path to eliminate Path 
> as a problem?
>

 The poppler package installed is poppler-win32-x86-64 which matches the 
64-bitness of my Racket.

Not sure precisely which mechanism you had in mind for trying number 2. But 
I tried editing ffi.rkt in the pdf-read package as follows:

; original: (define-ffi-definer define-poppler (ffi-lib "libpoppler-glib"))
; (A) tried adding version: 
;  (define-ffi-definer define-poppler (ffi-lib "libpoppler-glib" "8"))
; (B) tried absolute path: 
   (define-ffi-definer define-poppler (ffi-lib 
"C:\\Users\\Joel\\AppData\\Roaming\\Racket\\6.12\\lib\\libpoppler-glib-8"))

Both edits return basically the same error as before:

(A)  ffi-lib: couldn't open "libpoppler-glib-8.dll" (The specified module 
could not be found.; errid=126)
(B)  ffi-lib: couldn't open 
"C:\\Users\\Joel\\AppData\\Roaming\\Racket\\6.12\\lib\\libpoppler-glib-8.dll" 
(The specified module could not be found.; errid=126)

For testing I did:

#lang racket

(require ffi/unsafe setup/dirs); pdf-read)

(define paths (get-lib-search-dirs))

(define (poppler? path)
  (string-contains? (path->string path) "poppler-glib"))

(flatten (for/list ([p paths])
   (find-files poppler? p)))

Produces:

'(#)

So it should be able to find the dll at least. Perhaps it's just not able 
to load it for some other reason.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] error with pdf-read / libpoppler on Windows

2018-03-23 Thread Joel Dueck
This point is well taken. For my package's core functionality I mainly need 
to be able to get a page count and the size of the first page. I would 
rather not have to try and write my own functions to do that; even though 
it looks (from the docs you provided) like the parsing wouldn't be too 
difficult, it's annoying to reinvent the wheel and potentially have to 
support code that may break in any number of edge cases. But if I have to, 
maybe I'll make a separate package.

Security isn't really an issue for my package, but I'm already thinking my 
users should probably not have to deal with DLL problems like this.

The command line tool is a good idea too but doesn't seem like a good 
option for my package, which, again, I'd like to be useable without hassle 
on any platform.

The only other loss was that for my scribblings I was hoping to use 
`pdf->pict` to demonstrate the results of my code samples, but I suppose I 
could just fake it with some PNGs...and try to remember to update them if I 
change anything.

On Thursday, March 22, 2018 at 5:45:27 PM UTC-5, Neil Van Dyke wrote:
>
> Side comment for the list, on software engineering security practice... 
> If what you have to do with the PDF is simple to do to the raw PDF 
> format, and your code might be fed PDF files of provenance that you 
> don't control, it's probably better security not to involve Poppler. 
>
>
> https://nvd.nist.gov/vuln/search/results?adv_search=false_type=basic_type=overview_type=all=poppler
>  
>
> https://www.adobe.com/devnet/pdf.html 
>
> In the past, I've found that pure Racket is quite capable of parsing PDF 
> sufficient to do what I've needed to do for consulting clients (e.g., 
> extracting editable forms data). 
>
> A compromise, if you don't want to implement anything in pure Racket, 
> but a command line tool can do what you need, is to call that command 
> line tool from Racket, keeping likely memory exploits from giving 
> you a hard-to-debug mess in your Racket VM memory space.  If you want to 
> be extra careful, you can use various host OS features to isolate that 
> host process. 
>
> (Warnings: the PDF documentation is big, you'll appreciate why C and C++ 
> programmers have difficulty implementing PDF without filling it with 
> vulnerabilities, and you'll also get to see some totalitarian-friendly 
> features that have been added to PDF.) 
>
> (Also, it's not just the apparent authors of the immediate PDF tool in 
> whom you have to have confidence -- some of the PDF tools include 
> ancient-ancient PS C code, as well as link a lot of other 
> known-problematic libraries, such as for 2D pixmaps and fonts.) 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Windows Foreign Libraries

2018-03-23 Thread Dmitry Pavlov



On 03/23/2018 03:58 PM, silverfire...@gmail.com wrote:

Really silly question but I was using the rsvg package with racket/gui on Linux 
and everything was working fine.   I moved the code over to windows to try it 
out (after installing the rsvg package there) and it's complaining that 
librsvg-2.2.dll is missing.   I've now tried two separate .dll files in my code 
directory (one that was from the official gnome ftp) and racket throws an error 
that ($1 is not a valid Win32 application) when trying to call (ffi-lib) on it.


Two points:

First, you may want to modify config.rktd in the Racket distribution directory
so that (lib-search-dirs) contains the directory where your dll is located.
This is not needed if you have it in a system directory or load it by full path.

Second, your dll may refuse to load because some of its dependencies
are missing. You may use the freeware Dependency Walker (depends.exe)
to find out what is missing.


Regards,

Dmitry

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Windows Foreign Libraries

2018-03-23 Thread silverfire675
Really silly question but I was using the rsvg package with racket/gui on 
Linux and everything was working fine.   I moved the code over to windows 
to try it out (after installing the rsvg package there) and it's 
complaining that librsvg-2.2.dll is missing.   I've now tried two separate 
.dll files in my code directory (one that was from the official gnome ftp) 
and racket throws an error that ($1 is not a valid Win32 application) when 
trying to call (ffi-lib) on it.

Now I'm going to try building the .dll myself,  but I'm wondering if it's 
possible after I've got a .dll that works if you can somehow connect it 
with the rsvg package so when I compile for distribution in DrRacket it 
automatically includes the .dll I have.  It pretty much already does this 
for all the other gnome libraries racket/gui uses, and it'd be much easier 
than having to manually add it to the libs after it's done compiling.


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.