Fork me on GitHub
#beginners
<
2015-10-29
>
paulspencerwilliams10:10:55

Hi, not having used lein repl for a few weeks, I’ve forgotten how to include Java classes sourced from lein dependencies. In particular, I have a dependency:

:dependencies [[org.clojure/clojure "1.7.0"]
                 [org.seleniumhq.selenium/selenium-java "2.45.0"]
                 [org.seleniumhq.selenium/selenium-firefox-driver "2.45.0"]])
But fail to import or require it like
user=> (require '[org.openqa.selenium.firefox.FirefoxDriver :as ff-driver])

FileNotFoundException Could not locate 
org/openqa/selenium/firefox/FirefoxDriver__init.class or org/openqa/selenium/firefox/FirefoxDriver.clj on classpath.  clojure.lang.RT.load (RT.java:449)
I know about clj-webdriver, I’m just doing a bit of work for a demo tonight about Clojure interop.

meikemertsch11:10:27

@paulspencerwilliams When I had that last time I simply had forgotten to restart the REPL; did you?

paulspencerwilliams11:10:50

@meikemertsch: yeah, repl started after adding the dependency.

paulspencerwilliams11:10:38

I know my problem is a lack of understanding of loading / requiring and how the differ from within .clj ns files and code in the repl

paulspencerwilliams11:10:54

looks like it does - your google fu is great - I’d been searching clojure require selenium etc and was struggling!

meikemertsch11:10:40

I searched 'firefoxdriver in clojure’ simple_smile

paulspencerwilliams11:10:23

well… imports work although using the driver is causing

user=> (def driver (FirefoxDriver.))

CompilerException java.lang.reflect.InvocationTargetException, compiling:(form-init8874946729723677435.clj:1:1) 

paulspencerwilliams11:10:43

it’s a very old version of selenium. Just trying to get that old version.

paulspencerwilliams11:10:06

yeah, copied their code and it fails 😕

paulspencerwilliams11:10:37

java.lang.reflect.InvocationTargetException (NO_SOURCE_FILE:1)

paulspencerwilliams11:10:12

I have working code using selenium in another project. Just not running it from the REPL

paulspencerwilliams11:10:21

Em, unsure whether it was a version thing. It now works with 2.45.0 with their code.

clojuregeek15:10:48

@ian i think if you got from pragprog, if you bought the ebook you get a discount on the paper copy

ian15:10:46

Yeah, but I already bought the ebook. There's no option for getting just the paper copy with the discount of the bundle, as far as I saw.

ian15:10:22

I would like to buy the book for the full price but I can't justify it since I do already have a (digital) copy.

Alex Miller (Clojure team)15:10:22

you could contact them via <mailto:[email protected]|[email protected]> and see if that's possible, not sure

clojuregeek15:10:28

I got a copy of the beta when it was first released,, when i log into pragprog, go to my accounts, it lists it as a coupon for $15 off ... maybe because I got it so early?

roberto15:10:04

pragprog ebooks are not so bad compared to other publishers. I got the kindle version of Land of Lisp and the code is unreadable. Will have to buy the paper version. Since then, I’ve bought all my programming books as paper, except the pragprog books.

Alex Miller (Clojure team)15:10:23

@clojuregeek: I think that's how the beta program works

Alex Miller (Clojure team)15:10:58

you get the e-book for no cost and a coupon to buy the bundle if you want it

Alex Miller (Clojure team)16:10:31

the coupon let's you buy the print book at the reduced price you'd get in the combo, so you can essentially add on the print book later if you want

clojuregeek16:10:25

@alexmiller: cool... i am only and all digital now ... cept I did buy the paper book of Common Lisp when I found it at half price books....

akiva17:10:02

O’Reilly’s and Mannings' ePubs are good as well. I haven’t bought a printed tech book in years.

roberto17:10:18

Most of the tech books I’ve bought this year are printed except for the pragprog books.

roberto17:10:59

O’Reilly books are ok, but I don’t like the topics they cover. Most of them cover a specific technology that in a couple of years is outdated. They are more like manuals.

roberto17:10:32

While the books that cover more fundamentals look terrible in e-format. Case in point, Purely Functional Data Structures, GOOS & Land of Lisp

akiva17:10:34

I rarely buy O’Reilly anymore. Did pick up Living Clojure though, of course.

roberto17:10:49

yeah, I picked up Living Clojure too.

akiva17:10:04

I didn’t bother with the Land of Lisp ePub. I read that one in PDF.

roberto17:10:31

yeah, I wish I had done the same. I’m stuck with the kindle version that is unreadable.

akiva17:10:49

Sad. That’s a great book. F# got me into FP and Land of Lisp got me into, well, Lisp which got me into Clojure.

ian20:10:29

@alexmiller: thanks for the suggestion, but hopefully I'll be able to pay the full price soon instead. I'd rather support you and Ben fully.

ian20:10:16

It's interesting to see so many people move away from physical copies. My problem with digital is always that it feels too difficult to progress through the book compared to a physical copy. I think seeing the pages complete pile up on one side "feels" better.

roberto21:10:24

yeah, I feel the same way.

roberto21:10:40

also, reading ebooks doesn’t really fit with the way I read a book.

roberto21:10:58

I normally skim through the chapter first, before I start reading it. This is very hard to do with an ebook.

roberto21:10:28

it is okay for fiction, but not tech books.

wamaral21:10:02

I prefer physical books because "see code listing on page X" really bothers me on ebooks

wamaral21:10:45

I'd love a reader with vim keybinding though

wamaral21:10:47

<count>G C-] C-i C-o

wamaral21:10:50

those would be awesome

roberto21:10:42

you just mentioned one of the most frustrating things in ebooks about coding: “see code listing (or diagram) on page X"

ordnungswidrig21:10:16

roberto: that’s not an ebook then, it’s a „scanned printed book"

wamaral21:10:47

as most of them are simple_smile

ordnungswidrig21:10:01

it’s a long way to hypertext

roberto21:10:28

even if it had a link, it is not helpful

roberto21:10:42

because I want to see the code right beside the text that is talking about the code

roberto21:10:23

in a physical book, even if the code is in the other page, you can see it because you can see two pages at once.

wamaral21:10:55

or at least flip really fast between them

ordnungswidrig21:10:53

roberto: hypertext is not only link to a different page, you could also embed the targeted resource in place simple_smile

Alex Miller (Clojure team)21:10:13

and let you change it and re-run it :)

Alex Miller (Clojure team)21:10:05

I have a gorilla repl version of some of the Cognitect Clojure training materials at https://github.com/cognitect/clojure-lab if anyone wants to try it :)

ordnungswidrig21:10:01

@alexmiller: where’s the deploy to heroku / aws / do button? 😛

Alex Miller (Clojure team)21:10:45

gorilla does have a way to live serve each page (although the intra-page links won't work)

ordnungswidrig21:10:31

pink color is pink

Alex Miller (Clojure team)21:10:28

like that to live serve out of the repo

Alex Miller (Clojure team)21:10:13

I guess that doesn't let you actually run the repl examples, it's read-only

ordnungswidrig21:10:18

A very nice tool