Fork me on GitHub
#clojure
<
2015-12-24
>
mheld00:12:42

is there a standard user auth lib that folks use now?

mheld00:12:45

is it still friend?

mheld00:12:18

looks like buddy is more recent

roberto02:12:08

I use friend, haven’t had any compelling reason to use anything else.

rcanepa03:12:59

I am having an issue related to dates and postgresql. I want to insert a record with 3 fields (1 string and 2 dates), however, I am getting this error: PSQLException Can't infer the SQL type to use for an instance of org.joda.time.DateTime. Use setObject() with an explicit Types value to specify the type to use. org.postgresql.jdbc2.AbstractJdbc2Statement.setObject (AbstractJdbc2Statement.java:2134)

rcanepa03:12:33

I am using clj-time to parse a string to a DateTime.

rcanepa03:12:20

What else does postgres need to deal with a DateTime?

rcanepa03:12:39

The database columns are configured as Date.

roberto03:12:59

use to-sql-time

roberto03:12:21

or to-sql-date, depends on the type of the Date you have

nowprovision03:12:46

@rcanepa alternatives if you don't to transform your map enter/leaving db, implement jdbc protocls, eg https://github.com/nowprovision/webhookproxyweb/blob/master/src/webhookproxyweb/jdbc.clj

rcanepa11:12:52

@nowprovision: Are you suggesting me to use JSONB types? Is that similar to work with MongoDB?

solicode12:12:01

@rcanepa: If you implement ISQLParameter in clojure.java.jdbc, you won't have to explicitly convert your DateTime objects to its SQL equivalent. For example, I've used this before for automatically converting java.util.Date to java.sql.Date. You can do the same type of thing for Joda's DateTime as well.

(extend-protocol jdbc/ISQLParameter
  java.util.Date
  (set-parameter [v ^PreparedStatement ps ^long i]
    (.setObject ps i (java.sql.Date. (.getTime v)))))

rcanepa15:12:29

@solicode: Thanks, now I understand what @nowprovision tried to say with his suggestion.

asolovyov15:12:21

hey all! So I'm using pedestal with immutant and I want to add websockets. All the tutorials speak about (immutant.web.middleware/wrap-websockets compojure-routes my-ws-callbacks) stuff, but I don't have those routes, I have pedestal and it's interceptors. Any ideas how to do that with pedestal?

asolovyov16:12:32

I've tried to make a small handler, but it doesn't work anyway...

spacepluk16:12:18

is there any tool to do simultaneous clj/cljs testing?

magomimmo17:12:08

@spacepluk: you’re welcome

bradford18:12:32

Hiii. I’m doing some ETL-ish code, and trying to filter a map by another map. I’m attempting Specter (couldn’t figure out Traversy for this, but I’m OK with using it) — however, I don’t understand how to get

select
to return a map, instead of a value. Here’s the Q I asked. Any ideas? https://github.com/nathanmarz/specter/issues/45

kopasetik19:12:17

OK, why does (conj [(or (= 1 1) +)] 1 2 3) ;;=> [true 1 2 3] while (conj '(or (= 1 1) +) 1 2 3) ;;=> (3 2 1 or (= 1 1) +)? Why doesn’t (or (= 1 1) +) evaluate to true in the latter case?

roberto19:12:50

first: one is a list and the other is a vector

roberto19:12:34

conjoining to a list is done at the beginning

roberto19:12:39

conjoining to a vector is done at the end

roberto19:12:50

the second part of your question:

roberto19:12:03

when you prefix an expression with ‘`’

roberto19:12:14

it is short hand for (list)

roberto19:12:07

in your example: '(or (= 1 1) +) = (list or (= 1 1) +)

solicode19:12:51

'(or (= 1 1) +) is (quote (or (= 1 1) +)) With list, your code will work the way you probably intended it to: (conj (list (or (= 1 1) +)) 1 2 3)

solicode19:12:14

quote and list aren’t the same

solicode19:12:24

But like roberto said, lists and vectors behave differently with conj

cddr19:12:10

Does anyone from pubnub hang out here? One of them gave a presentation about how they use samza and clojure together and I was wondering if they could share any code demonstrating how they glue it all together

bbloom23:12:36

question for the fellow language-laywer/theorists: what’s the purpose of clojure.core/or’s behavior as documented "otherwise it returns the value of the last expression"

bbloom23:12:58

that is, (or) evaluates to nil, but (or false) evaluates to false.

bbloom23:12:51

i guess so that you can coerce nil to false by (or blah false) ?