Fork me on GitHub
#beginners
<
2019-08-11
>
sova-soars-the-sora00:08:15

DRM strategies so people don't just copy/paste pay-to-access articles?

sova-soars-the-sora00:08:31

maybe generate an image instead of rendering raw text ... was my thought

seancorfield00:08:28

I'm not a fan. I prefer to trust people. DRM is a huge amount of work for really a small payback and it often has negative impact on people with disabilities.

seancorfield00:08:26

(in particular, generating an image instead of text prevents assistive technology from working which blind people rely on -- a lawsuit just waiting to happen in the US!)

seancorfield00:08:30

(If we want to discuss this in more depth, we should probably move to #off-topic since it really isn't Clojure-specific and not really even tech-specific, let alone beginner friendly)

sova-soars-the-sora00:08:53

Yeah I dislike DRM too

sova-soars-the-sora00:08:00

maybe just a thoughtful note is enough

seancorfield00:08:16

Trying to think which of the online book sellers it is that makes a big point that their PDF format books are DRM-free and rely on trust not to share the books/undermine their business...

seancorfield00:08:28

Even all that aside, DRM is hard tech to work with. It usually involves encryption, license verification systems, "phoning home"... all of which are "incidental complexity".

sova-soars-the-sora00:08:30

how do you feel about disabling copy/paste on pay-to-read articles?

seancorfield00:08:47

Not worth it. It's easy to get around for anyone who cares.

seancorfield00:08:24

And it's a really annoying inconvenience for folks who've actually paid to read this and want to clip some text for later reference.

sova-soars-the-sora00:08:26

remind me to bust out the hostile architecture slides more often 😂

sova-soars-the-sora00:08:58

Rome was a Hostile Architecture 😂

sakalli10:08:18

saw someone talking about having a keybinding that saves the result of an evaluated operation to a temporary var that can be used for debugging. might have been @seancorfield. that sounded super handy. though iirc he is not using emacs. does anyone know if this function exist for emacs. in cider or similar. or should it be written?

sakalli10:08:00

(or perhaps there is a better workflow?)

alpox12:08:37

@sakalli The only thing I know of is that you can reference the last evaluated values with *1 *2 etc. where *1 is the last value evaluated and *2 the second last

🙏 4
joshkh12:08:27

i'm following the basic gen-class example [1] from the http://clojure.org docs website. my example class compiles just fine (present in classes/clojure/examples/hello.class), but i'm having trouble running it. am i missing something obvious? 🙂 [1] https://clojure.org/reference/compilation#_gen_class_examples

$ java -cp ./classes:clojure.jar clojure.examples.hello Fred
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
	at clojure.examples.hello.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	... 1 more

👍 4
joshkh13:08:12

of course... i was missing clojure.jar. however, when i add clojure-1.10.1.jar i get the following: Caused by: java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class, clojure/spec/alpha.clj or clojure/spec/alpha.cljc on classpath.

Alex Miller (Clojure team)16:08:34

page updated to use new clj command line tool

joshkh19:08:48

cheers, Alex!

mfikes14:08:09

@joshkh Newer versions of Clojure depend on spec. I think the example on that page is a little outdated. One easy way to ensure you get the spec dependency is to use the new command line tools to run Clojure in lieu of invoking java directly: https://clojure.org/guides/deps_and_cli

Alex Miller (Clojure team)14:08:58

Yeah that example is old, I can fix it up

👍 4
sakalli15:08:11

thanks @alpox, those are handy as well. hacked a couple of elisp functions for this. C-c w saves the the symbol before the point and C-c c evaluates last expression and binds it to the saved symbol. If no symbol exists it binds it to 'temp

(defun eval-last-sexp-to-var ()
  "Evaluates last sexp and binds it to symbol stored in 'saved-symbol.
saved-symbol defaults to 'temp"
  (interactive)
  (if (not (boundp 'saved-symbol)) (setq saved-symbol "temp"))
  (cider-interactive-eval
   (format (concat "(def " saved-symbol " %s)")
           (cider-last-sexp))))

(define-key cider-mode-map (kbd "C-c c") 'eval-last-sexp-to-var)


(defun set-last-sexp-to-symbol ()
  "Saves the last sexp to 'saved-symbol for use with eval-last-sexp-to-var"
  (interactive)
  (setq saved-symbol (cider-last-sexp)))

(define-key cider-mode-map (kbd "C-c w") 'set-last-sexp-to-symbol)

alpox15:08:09

@sakalli A bit over my head (Never used elisp really) but it looks quite useful! 😄 thanks, I'll see if I can make some use of it

sakalli15:08:08

pretty n00b myself so "hacked" would the appropriate term. 🙂

alpox15:08:45

I wonder if I could dump this somewhere in my spacemacs config

sakalli15:08:54

Not a spacemacs user, but think you can just paste those in the config or at least that there is an area where you can save your own customizations. You might want to change those keybindings to something more appropriate for spacemacs tho

murtaza5215:08:08

@alpox look at the spacemacs config file, you can put all your custom configs in that file. however spacemacs comes with pretty decent defaults and key bindings. look at the specific layer to see if the keybindings are already not there- http://develop.spacemacs.org/layers/+lang/clojure/README.html

sakalli15:08:14

sorry @alpox there was an error in the first funciton ^^ updated it, should be working now.