This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-26
Channels
- # announcements (3)
- # babashka (28)
- # beginners (21)
- # cider (29)
- # clojars (10)
- # clojure (14)
- # clojure-australia (3)
- # clojure-europe (48)
- # clojure-nl (3)
- # clojure-sanfrancisco (4)
- # clojure-uk (54)
- # clojurescript (34)
- # cryogen (12)
- # cursive (7)
- # datomic (14)
- # devcards (1)
- # fulcro (23)
- # helix (2)
- # java (5)
- # jobs (1)
- # kaocha (15)
- # malli (13)
- # minimallist (1)
- # off-topic (8)
- # pathom (7)
- # pedestal (1)
- # rdf (10)
- # reagent (18)
- # shadow-cljs (58)
- # spacemacs (3)
- # tools-deps (1)
- # vim (6)
- # xtdb (37)
Hi~! Is there a utility that I can get(or assoc) all values in nested map with vector?
(def data
{:a [{:b {:c [{:d 1}]}}
{:b {:c [{:d 2}]}}]})
;; It's ok
(get-in data [:a 0 :b :c 0])
=> {:d 1}
;; Like this?
(get-all data [:a :* :b :c :*])
=> [{:d 1} {:d 2}]
;; Like this?
(assoc-all data [:a :* :b :c :* :e] 3)
=> {:a [{:b {:c [{:d 1
:e 3}]}}
{:b {:c [{:d 2
:e 3}]}}]}
Im curious what the real situation is. Both libs mentioned will help. But always suspect there is a database issue at play when I see questions like this.
Has anyone here used etaoin to print a pdf of a web page? Webdriver spec has the command. There are examples here for c# and Java: https://stackoverflow.com/questions/47387776/chromedriver-print-to-pdf-after-page-load#48405542 , but when I look in the code for etaoin I don’t see it implemented. Are there other clojure options?
Is there a way with transit-clj to serialize sorted-maps?
IThanks a lot @gon!
I have a question about multimethods: if a method is defined in two different namespace wit the dispatch value, and they are both loaded into a new namespace, which one will take precedence?
I tried in Clojure and it appeared to me that it was the namespace which was imported last (which somehow made sense), but then I tested in ClojureScript and the order was not relevant.
I am asking because I need to overwrite one of the dispatch function.
Hello everyone,
Could you please help me with a jdbc
function call?
I have this:
(jdbc/execute! db/*db*
["update request
set timestamp = ?
where id = ?
returning *"
"2020-11-26T15:37:45.13-06:00"
621])
But I’m getting this error:
Execution error (PSQLException) at org.postgresql.core.v3.QueryExecutorImpl/receiveErrorResponse (QueryExecutorImpl.java:2477).
ERROR: column "timestamp" is of type timestamp with time zone but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Position: 61
I understand that "2020-11-26T15:37:45.13-06:00"
is the standard date format (ISO-8601), but I don’t know why it’s not working.
Thanks!On psql
this works fine:
update solicitudes.solicitud
set modificación_horario = '2020-11-26T15:37:45.13-06:00'
where solicitud_id = 621
returning *
it seems like you might need to pass a timestamp instance instead of a string - <https://stackoverflow.com/questions/9305541/clojure-jdbc-postgresql-i-am-trying-to-update-a-timestamp-value-in-postgresql-f>
PostgreSQL can be pretty fussy about date/time fields -- see for example https://cljdoc.org/d/seancorfield/next.jdbc/1.1.613/doc/getting-started/tips-tricks#working-with-date-and-time -- but you'll definitely want to be using an actual date/time value and not a string.
If you're using clojure.java.jdbc
, I'll point out that's not actively maintained any more and you should consider using next.jdbc
(the latter is the "1.0" release that I was not able to give c.j.j because I needed to make some big changes, based on what I'd learned maintaining c.j.j for many years).
Also, that SO answer suggests clj-time
@U013JFLRFS8 which is deprecated now and the readme recommends either using Java Time directly or one of the wrapper libraries (and, yes, clj-time
is another one of my libraries where I want people to migrate off it to something else 🙂 ).