Fork me on GitHub
#beginners
<
2019-08-02
>
Ahmed Hassan05:08:36

This is ns declaration in https://github.com/metosin/tilakone#intro example code, why do we need empty :refer here?

hiredman05:08:09

It isn't empty, it is referring something named _

GC06:08:59

I was reading clj-time's doc, it said if you are using java 8 , migrate to java-time

GC06:08:11

is it going to be deprecated???

thumbnail06:08:14

no, but java8 introduced a new time api. java-time is just a wrapper of this native java api opposed to a wrapper of an external lib (yoda-time).

thumbnail06:08:27

it’s just better practice and will probably have better forward compatibility

GC06:08:45

So, there's no case in converting the codebase to native one

thumbnail07:08:16

Unless you have a clear usecase for java-time > clj-time , no

Godwin Ko08:08:02

when dealing with db timestamp field, #inst is return instead of java-time object, it’s kind of annoying and require conversation in order to use java-time function library, any hints or suggestion about that?

schmee09:08:00

you can register your own data reader that converts an #inst to whatever class you want, see https://clojure.org/reference/reader#tagged_literals for info on how to do that!

alexmiller12:08:08

I don’t think that’s the problem here - inst is just a print format, not a type

alexmiller12:08:34

Use class to check the actual type - it’s probably either a java.util.Date or a java.time.Instant, both of which print as #inst

Godwin Ko13:08:54

@U064X3EF3 You’re right, date field read from db is java.sql.Date, which I have to convert to java.time.LocalDate in order to use java-time library

Godwin Ko13:08:05

@U3L6TFEJF Thx for you answer. I’m using HugSql + clojure.java.jdbc, not sure if I can still use data reader to convert into the class that I want :thinking_face:

alexmiller13:08:48

you should be able to do that, but I've been away from jdbc for a long time

Godwin Ko13:08:50

so what other library you’d suggest to retrieve data from rdms? 🙇:skin-tone-2:

alexmiller13:08:00

you should use jdbc, I just don't remember the details of how to do what you want

Godwin Ko13:08:12

oh, but thanks anyway

Godwin Ko13:08:18

finally got what I want by using extend-protocol jdbc/IResultSetReadColumn with result-set-read-column to convert to corresponding java-time equivalent object

Mattias09:08:15

Hi! I’m starting to use Hiccup for some simple web frontends. I’m familiar with different web stacks but would like some pointers on idiomatic or just sensible ways to work with Hiccup. Any pointers? Also new enough with Clojure, fwiw. Thanks!

Mattias09:08:14

Side question - Hiccup hasn’t been updated in a while. Not that basic HTML has changed much lately, but is there any more active library I should be looking at?

schmee09:08:18

nothing to worry about, many clojure libraries are very stable and “just work”

schmee09:08:04

usually you get better answers that more specific you question is, “sensible ways to work with hiccup” is a very broad subject, I suggest you just mess around with it and if you run in to any blockers then ask about that 🙂

Mno09:08:03

just keep in mind hiccup is just used to generate html and it's a clj only library (so no cljs), it (thankfully) does nothing else. Other than that schmee's advice is on point.

David Pham11:08:15

You can use reagent if you need Hiccup for cljs I guess

Mattias12:08:35

Ok, thanks all! I’ll start generating HTML and see how it feels 😄

sova-soars-the-sora21:08:42

I want to train a neural net to play chess based only on move notation