Fork me on GitHub
#clojure
<
2016-12-18
>
jrheard03:12:18

i don’t want to be rude but that doesn’t seem super relevant to this channel

seancorfield03:12:58

They have been banned.

jrheard03:12:00

does that happen a lot?

seancorfield03:12:27

Twice in the last couple of months. Can't remember it happening before then. Maybe just once or twice in total previously?

jrheard03:12:35

we’re gettin famous!

roelofw09:12:44

There was some time ago someone has shown a list of project a beginner can make as projects for his/her resume.

roelofw09:12:09

Can someone point me to that page so I have some project to start with

roelofw12:12:41

that was the page im looking for

genec14:12:12

How does the Oracle enforcement of the Java SE license affect the use of Clojure for enterprise projects? I'm going to get this question at work soon. I'm assuming we will need a Java license from Oracle for each install.

lmergen14:12:09

@genec: i think it will pretty much be the same as any java project. you can also choose to use openjdk

kevinbheda14:12:52

using postgresl and clojure jdbc and honeysql I tried this below stuff but got the error "You might need to add explicit type cast” as guid column is of data type uuid

(defn get-my-value [db-spec guid]
(jdbc/query db-spec (sql/format
                           (sql/build :select [:mycolum]
                                      :from :mytable
                                      :where [:= :guid guid]
                                      :limit 1))))
I googled and found that i need to somehow generate this kind of query, any thoughts on how to do this in clojure
select mycolum from mytable where guid =  CAST (‘abc-def’ as uuid) ;

dergutemoritz15:12:10

@kevinbheda Try passing guid as a java.util.UUID

dergutemoritz15:12:49

That should obviate the type cast

roelofw16:12:33

Why do I see here a non resolved error :

(testing "list : conj"
    (is (= (list-conj) (conj '(2 3 4) 1)))
    (is (=  (list-conj) (conj '(3 4) 2 1))))
 

roelofw16:12:00

where the function does exist :

(defn list-conj
  "When operating on a list, the conj function will return a new list with one or more items \"added\" to the front."
  []
  (identity '(1 2 3 4)))  

dpsutton16:12:57

let's go to #beginners

fevral1316:12:12

Hi, I am trying to create Luminus project with additional profile hints, as described at http://www.luminusweb.net/docs/profiles.md, but leiningen complains that some of profile hints are not recognized: `--> lein new luminus new_luminus_application +postgres +re-frame +auth Unrecognized options: +auth, +re-frame Supported options are: +site, +h2, +dailycred, +cljs, +static, +http-kit, +cucumber, +mongodb, +postgres, +mysql But both auth and re-frame are in available list. What am I doing wrong?

jrheard17:12:25

haven’t used luminus, but my first guess would be to check whether my leiningen was up to date

jrheard17:12:33

eg on os x i’d run brew upgrade leiningen

lxsameer17:12:04

is it possible to create a proxy namespace ? for example I want namespace B to contain functions of namespace A

gfredericks17:12:18

@lxsameer that ztellman library can do that

lxsameer17:12:36

let me check that out and thank you

fevral1317:12:02

@jrheard thanks, but my lein is of latest version. Probably, clojars repository has old luminus template

gfredericks17:12:33

find ~/.m2 | grep luminus should suggest which version you're using

fevral1317:12:36

@gfredericks , I deleted ~.m2/repository/luminus and tried to create the project again: `--> lein new luminus new_luminus_application +auth +postgres +re-frame Retrieving luminus/lein-template/1.16.7/lein-template-1.16.7.pom from clojars Retrieving luminus/lein-template/1.16.7/lein-template-1.16.7.jar from clojars Unrecognized options: +auth, +re-frame Supported options are: +site, +h2, +dailycred, +cljs, +static, +http-kit, +cucumber, +mongodb, +postgres, +mysql It downloaded the latest template from clojars and it still did not know about +auth and +re-frame

gfredericks17:12:39

I dunno anything about luminus, just had a suggestion for devining the version

henriklundahl18:12:36

@fevral13, the latest Luminus template is 2.9.11.18.

fevral1318:12:46

Just in case if anybody faces similar issue: my lein was downloading VERY outdated luminus template: 1.16.7 instead of 2.9.11.18. This was due to hardcoded value in ~/.lein/profiles.clj {:user {:plugins [[luminus/lein-template "1.16.7"]]}}, that could be left from my previous experiments with following clojure web development book. Deleting that file ~/.lein/profiles.clj solved my problem, lein downloaded the latest luminus template and all profile hints 🙂

fevral1318:12:32

yes, @henriklundahl thank you, I was just finishing typing that 🙂

joshkh19:12:53

Could someone help me understand what I'm doing wrong with Java interop? I'm trying to translate this:

PDFont font = PDTrueTypeFont.loadTTF(document, "Arial.ttf");
Into clojure...
(.loadTTF PDTrueTypeFont document "Arial.ttf")
But I'm getting the following error
java.lang.IllegalArgumentException: No matching method found: loadTTF for class java.lang.Class
Do I need to cast the result to a PDFont?

dpsutton19:12:10

that looks like a static method

dpsutton19:12:26

try (PDTrueTypeFont/loadTTF ...)

dpsutton19:12:32

i'm' not too up to speed on interop though

joshkh19:12:36

hmmm, that didn't seem to work Caused by: java.lang.IllegalArgumentException: No matching method: loadTTF

joshmiller19:12:15

@rodeorockstar Looks like you need to provide a File, not a string filename, as the second argument there.

joshkh21:12:17

Hmm, even if it does take a File, I can't seem to access the static method in the first place

joshkh21:12:46

okay, so i figured it out, and you were right @joshmiller. thanks! i rarely touch java so this might not be 100% true, but loadTTF is an overloaded static method, and i think clojure couldn't find a method with a signature of document + string

joshkh21:12:25

slightly confusing error message because the method exists, just one that accepts a document object and a File

joshkh21:12:02

(and it didn't help that PDFBox's own example passes the file name as a string when clearly the javadocs state otherwise ;))

dpsutton21:12:02

just as an aside, when i looked that function up it was marked as deprecated

joshkh21:12:16

yes, that too!

seylerius22:12:40

Okay, tell me if this sounds crazy: I've got a seq of maps. I need to process them on an API, which can take up to 100 items or 32K at a time. I need to put the result of input a back into the spot it came from. Is this a case for pmap? And do I want to have an arrangement where the function that sends them off to the API worker receives the input and a channel to return the result on, to ensure that sender gets back the result it wants?

mattsfrey23:12:50

question - I have a vector of maps, i.e. [{:name "Matt" :emails [{:value "<mailto:[email protected]|[email protected]>"} {:value "<mailto:[email protected]|[email protected]>"}]}] and I want to iterate over it and produce another vector of maps that creates additonal maps for each atomic email, i.e. the above would become -> [{:name "Matt" :email "<mailto:[email protected]|[email protected]>"} {:name "Matt" :email "mattsfrey@gmail"}] what is the best way to accomplish this?

mattsfrey23:12:28

nvm i got it with two nested maps fed to a reduce

metametadata23:12:42

(mapcat (fn [{:keys [name emails]}]
          (map #(-> {:name name :email (:value %)})
               emails))
        input)

jeremyraines23:12:02

anyone here use ztellman/automat? I have a problem which I think relates to AOT — which I don’t fully understand — where an X11 process gets started from a namespace I don’t use in my app. If anyone could offer general or specific guidance I’d appreciate it.

mattsfrey23:12:03

mapcat is cool

mattsfrey23:12:55

So I hit a second issue - how to deduplicate the resulting set based on :email ? Any suggestions?

mattsfrey23:12:18

basically would like to have a dedupe or distinct that takes a predicate or some such

gfredericks23:12:34

plumatic/plumbing has a distinct-by

gfredericks23:12:37

you could use that or paste it

mattsfrey23:12:00

@gfredericks that is perfect, awesome tip! thanks!