nextjournal

2021-10-11T07:35:27.114700Z

yes, hiding code is fine. It goes then into writing "tutorials" for others, with hiding parts of the code. In notespace we can do this individually for expressions, but as well globally

2021-10-11T07:37:33.116500Z

I was just trying to load a large file, 287 MB csv. In teh repl, this just work in 2 seconds. In notespace as well, as long a I don't visualize it in the browser. In Clerk I cannot prevent it's visulaisation (except with a workarround),

2021-10-11T07:37:48.116900Z

so the browser crashes.

2021-10-11T07:40:05.117400Z

The work arround is this:

(def _
  (def large-ds
    (->
     (tc/dataset "/home/carsten/Dropbox/sources/scicloj-data-science-handbook/Reviews.csv"))))

2021-10-11T07:43:05.118900Z

Therefore I am still wondering, if the default behaviour of Clerk to "render" a "def ..." can scale up well.

2021-10-11T07:44:27.119900Z

None of the other notebooks does this. Jupyter, notespace, gorilla and others don't render the variable defined in a "def"

2021-10-11T07:45:33.120300Z

helios 2021-10-11T07:45:54.121Z

^:clerk/no-render as metadata might make sense, similarly to the no-cache option, for hiding code

2021-10-11T07:46:16.121600Z

yes, sounds good.

2021-10-11T07:46:35.122Z

Indeed only a few expressions would need this.

2021-10-11T07:47:05.122500Z

(Nevertheless It would be different then in other notebooks, but that would be ok for me)

2021-10-11T07:53:10.123100Z

I just see the reasoning behind the decision....

2021-10-11T07:53:12.123200Z

Caching...

2021-10-11T07:53:42.123800Z

so I should not use a def for this case, right ?

2021-10-11T07:54:20.124500Z

I should make a method with defn, which loads the data and rely on caching

2021-10-11T07:54:50.124800Z

(defn get-large-ds []
  (tc/dataset "/home/carsten/Dropbox/sources/scicloj-data-science-handbook/Reviews.csv"))
(-> (get-large-ds)
    ds/row-count)


(-> (get-large-ds)
    ds/shape)


(-> (get-large-ds)
    ds/column-names)

mkvlr 2021-10-11T08:01:01.128900Z

@carsten.behring the Clerk viewers should only render a subset of the data, so what your seeing is most definitely a bug I want to fix. Note that this currently doesn't apply to the table viewer which currently loads all data. Fixing that is also very high priority.

mkvlr 2021-10-11T08:06:04.132600Z

the reasoning for showing the contents of a var is seeing the contents, which I do believe is helpful. Obviously only once the issues you're seeing with large data are fixed. Still considering showing the var alongside with the contents though.

mkvlr 2021-10-11T08:08:51.134100Z

I also think I can put some safeguards in place to prevent too much data to be transmitted to the browser.

2021-10-11T08:35:23.136100Z

We have worked quite a lot wit large data structures in notebooks. "preventing" and "safeguards" seem to be a tricky business to me, and has a risk of failure in special cases.

2021-10-11T08:38:44.137200Z

I have a hard time with Cider repl as well, that sometimes it tries to print my large data structures, which makes Emacs crash.

mkvlr 2021-10-11T08:56:20.140500Z

Yep, I understand. The safeguard I have in mind is not printing the value of the var if it exceeds a certain size. @thheller does this successfully in shadow inspect https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/remote/runtime/LimitWriter.java

mkvlr 2021-10-11T09:00:55.142100Z

@thheller are you aware of any cases where the limit writer approach fails ie shadow inspect crashes the browser?

2021-10-11T10:56:40.146700Z

The limiting writer looks good to me. The idea of limit by byte seems (more) robust then "counting of vector lengths" or similar. The limit should be configurable, to account for large clj files with lots of sexp vs small file with a few sex. In Cider I saw the "limit" always as a measurement to "avoid user mistake". Because in practice I don "want" to see several pages of output on the screen. It should only happen (in Cider), if I do a mistake and evaluate something by mistake.

2021-10-11T10:58:17.148200Z

In Clerk it's a bit different, as we cannot limit as a user , so the system limit need to work in "all cases". But "byte counting" seems to be the correct approach.

thheller 2021-10-11T15:32:00.149400Z

no known issues with limit writer. well except that it very dumb and usually cuts stuff off mid structure. a smarter one that doesn't truncate keywords or so would be nice but its usually not an issue

๐Ÿ™ 1
2021-10-11T17:55:34.150200Z

Did the viewer for svg disappear ? It's used in the demo, but I cant find it ?

mkvlr 2021-10-11T20:40:10.152900Z

@carsten.behring itโ€™s not there yet, still on the list. It was in my talk, but only as a picture. ๐Ÿคซ

2021-10-12T07:31:17.171300Z

I tried v/html and it just worked with SVG:slightly_smiling_face:

mkvlr 2021-10-12T07:55:09.171500Z

oh, thatโ€™s a pleasant surprise

littleli 2021-10-11T21:10:19.155200Z

I'd like to report something minor about clerk. I wanted to try from Windows. It launched ok until this point:

user=> (clerk/show! "notebooks/hello.clj")
Execution error (AssertionError) at rewrite-clj.node.whitespace/newline-node (whitespace.clj:89).
Assert failed: (string-of? s r/linebreak?) 
It seems like newline-node on Windows does not like line endings. Maybe @lee do you understand what's going on there?

lread 2021-10-11T21:12:26.157100Z

Hiya @ales.najmann, this was a problem in rewrite-clj v0, but should work in rewrite-clj v1. Are you using rewrite-clj v1?

littleli 2021-10-11T21:15:22.157200Z

I just launched clerk-demo from the master. So probably I have to check what landed on classpath

mkvlr 2021-10-11T21:17:04.158Z

rewrite-clj/rewrite-clj 0.6.1 currently

lread 2021-10-11T21:17:40.158200Z

I recommend an upgrade to rewrite-clj v1. Fixes a bunch of other issues too.

mkvlr 2021-10-11T21:17:55.158400Z

@lee will do, thanks!

mkvlr 2021-10-11T21:18:40.158600Z

@ales.najmann if you have the time would be great if you could force the latest rewrite-clj version by adding it to the deps.edn of the demo project and let me know if it resolves your issues ๐Ÿ™

lread 2021-10-11T21:18:42.158800Z

I donโ€™t think you will run into issues, but if you do, feel free to ping me or visit #rewrite-clj!

๐Ÿ™ 1
mkvlr 2021-10-11T21:19:44.159100Z

@ales.najmann latest version should be rewrite-clj/rewrite-clj {:mvn/version "1.0.699-alpha"}

littleli 2021-10-11T21:22:47.159300Z

Update to the latest let me pass over the parsing issue.

๐Ÿ’ฏ 1
1
mkvlr 2021-10-11T21:36:46.161700Z

perfect, thanks, I'll bump it for the next release, probably tomorrow

lread 2021-10-11T21:57:03.165200Z

@mkvlr if you have public projects that use rewrite-clj, I can add them to https://github.com/clj-commons/rewrite-clj/blob/main/doc/02-developer-guide.adoc#libs-test. Lemme know!

mkvlr 2021-10-11T21:16:19.157900Z

@ales.najmann oh but itโ€™s working for you on windows? I also got reports that it doesnโ€™t work at all with this stacktrace https://gist.github.com/mmwaikar/007cb6f76798527c76d78cba75b3b9f2

littleli 2021-10-11T21:23:35.159500Z

Yeah. So parsing issue is gone (see the other thread). Now I'm within territory of this issue

littleli 2021-10-11T21:23:39.159700Z

user=> (clerk/show! "notebooks/introduction.clj")
Execution error (UnsupportedOperationException) at sun.nio.fs.WindowsSecurityDescriptor/fromAttribute (WindowsSecurityDescriptor.java:358).
'posix:permissions' not supported as initial attribute

littleli 2021-10-11T21:24:06.159900Z

but...

littleli 2021-10-11T21:24:27.160100Z

it can be from the filewatcher, no?

littleli 2021-10-11T21:24:36.160300Z

let me try without

littleli 2021-10-11T21:25:17.160500Z

nope

littleli 2021-10-11T21:28:18.160700Z

I don't know about beholder, but you'd have to use probably this guy over here to have portable filewatching. Not sure how much it can be trusted though. http://commons.apache.org/proper/commons-io/apidocs/index.html?org/apache/commons/io/monitor/package-summary.html

mkvlr 2021-10-11T21:37:46.162800Z

I have a wip for the fs issue, will try to get it out tomorrow

littleli 2021-10-11T21:38:28.163Z

no worries. Ping me whenever you need to. I'll try to reach you back as soon as I can.

๐Ÿ™ 1
littleli 2021-10-11T21:42:11.165Z

btw I'm fan of Nextjournal. I'm not a data scientist but I like playing around with it. Check my dashboard here if you like https://nextjournal.com/littleli/homomorphic-encryption-in-clojure

๐Ÿ—๏ธ 2
๐Ÿ™Œ 1
๐Ÿ™Œ๐Ÿผ 1
mkvlr 2021-10-11T05:43:47.112700Z

Makes sense. Do you think being able to hide just the code is enough and the result should always stay visible? I'm leaning towards yes then we can use that as an indicator so folks and show the code cell again. Becomes harder when we hide both.