Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Orestis Markou
You might need to quote the string with single quotes, otherwise bash will 
probably try and interpolate a var `$n`...

> On 4 Mar 2022, at 15.58, Lawrence Krubner  wrote:
> 
> Okay, this seems to have to do with characters acting as wildcards in the 
> password itself. This is in the .env file:
> 
> vvv*8Ezr30R%$n?L5!
> 
> but printlin in the Clojure code outputs:
> 
> vvv*8Ezr30R%?L5!
> 
> The "$n" simply vanishes. 
> 
> Why is that? This is not a regular expression. I didn't think plain strings 
> in Clojure would be interpreted like this. 
> 
> Or is this how bash interprets it? 
> 
> 
> 
> 
> On Friday, March 4, 2022 at 8:06:56 AM UTC-5 Lawrence Krubner wrote:
> So, as a new way to test this, I've ssh'ed to an EC2 instance that is in the 
> same VCP as the RDS database. I upload my jar file so I can run it on this 
> EC2 instance.
> 
> println the hash map at startup:
> 
> {:dbtype mysql, :dbname pulsedata, :user pulseuser, :password , :host 
> pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com 
> }
> 
> This gets me the above error. But if I copy and paste the values and use them 
> with the mysql client:
> 
> mysql -u pulseuser -h pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com 
>  -p pulsedata
> 
> I am able to log in. This is in the same terminal window: the MySQL client, 
> at the command line in my terminal, logs me into MySQL, but "java -jar 
> user.jar" in the same terminal window gives me this error, about me being 
> rejected. I am copying and pasting the same values for user and host and 
> password. 
> 
> It has to be something about the Clojure code. 
> 
> 
> On Friday, March 4, 2022 at 6:35:59 AM UTC-5 ore...@orestis.gr 
>  wrote:
> The error message indicates that you connect with user `pulseuser` - is that 
> the expected user? 
> 
> I would print out the configuration that you’re passing in to jdbc.next to be 
> absolutely certain it contains the values you expect it does.
> 
> When you say “cli”, do you mean a mysql client? Double check the credentials 
> (dbname, user, password) that *it* uses. 
> 
> Best,
> Orestis
> 
> 
>> On 4 Mar 2022, at 13.27, Lawrence Krubner > wrote:
>> 
> 
>> But, again, I can connect from the cli using my terminal. I'm using my 
>> Spectrum connection to the Internet in both cases. If I run the app on my 
>> laptop, or I connect from the terminal, using the CLI, then in all cases I'm 
>> connecting over my Spectrum connection to the Internet. If MySQL was going 
>> to block one, then it would block the other, yes? I think the issue must 
>> have something to do with the Clojure code, since that is the only 
>> difference. I mean, if I do "java -jar user.jar" in the same terminal 
>> window, it fails, but then in that same terminal window I can connect to RDS 
>> without a problem using the CLI. 
>> 
>> 
>> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 red...@gmail.com <> wrote:
>> That is a message from MySQL, not next.jdbc.
>> 
>> MySQL allows you to grant permissions to a user base on the host they are 
>> connecting from so permission denied kinds of errors include the username 
>> and the host the users connection came from.
>> 
>> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner > wrote:
>> I just wrote a small app that needs to connect to a MySQL app. I was running 
>> it on my laptop, connecting to MySQL on the laptop, and everything was 
>> working fine. Then I wanted to connect to one of our test databases in RDS 
>> in AWS. I've a simple function that finds the environment variables and 
>> returns them as a map:
>> 
>> (defn get-config
>>   []
>>   (check-config)
>>   {
>>:dbtype "mysql"
>>:dbname (System/getenv "DATABASE_NAME")
>>:user (System/getenv "DATABASE_USER")
>>:password (System/getenv "DATABASE_PASSWORD")
>>:host (System/getenv "DATABASE_HOST")
>>})
>> 
>> This is used simply:
>>   ds (jdbc/get-datasource  (get-config))
>> 
>> I've checked the environment values several times and they are correct. But 
>> when the code tries to write to the RDS database, I get: 
>> java.sql.SQLException: Access denied for user 
>> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
>> ' (using password: YES)
>> 
>> I am connecting to the Internet through Spectrum, and apparently "rr.com 
>> " is Spectrum. I'm confused, why would next.jdbc use this 
>> info? Did I forget some important value in the hash map? 
>> 
>> From my laptop, I can reach the RDS database using the MySQL CLI, so there 
>> are no problems with connectivity. I whitelisted the IP address of my house. 
>> This is something specific about what next.jdbc needs in that hash map, I 
>> think.
>> 
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com <>
>> Note that 

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Orestis Markou
The error message indicates that you connect with user `pulseuser` - is that 
the expected user? 

I would print out the configuration that you’re passing in to jdbc.next to be 
absolutely certain it contains the values you expect it does.

When you say “cli”, do you mean a mysql client? Double check the credentials 
(dbname, user, password) that *it* uses. 

Best,
Orestis

> On 4 Mar 2022, at 13.27, Lawrence Krubner  wrote:
> 
> But, again, I can connect from the cli using my terminal. I'm using my 
> Spectrum connection to the Internet in both cases. If I run the app on my 
> laptop, or I connect from the terminal, using the CLI, then in all cases I'm 
> connecting over my Spectrum connection to the Internet. If MySQL was going to 
> block one, then it would block the other, yes? I think the issue must have 
> something to do with the Clojure code, since that is the only difference. I 
> mean, if I do "java -jar user.jar" in the same terminal window, it fails, but 
> then in that same terminal window I can connect to RDS without a problem 
> using the CLI. 
> 
> 
> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 redc...@gmail.com wrote:
> That is a message from MySQL, not next.jdbc.
> 
> MySQL allows you to grant permissions to a user base on the host they are 
> connecting from so permission denied kinds of errors include the username and 
> the host the users connection came from.
> 
> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner  > wrote:
> I just wrote a small app that needs to connect to a MySQL app. I was running 
> it on my laptop, connecting to MySQL on the laptop, and everything was 
> working fine. Then I wanted to connect to one of our test databases in RDS in 
> AWS. I've a simple function that finds the environment variables and returns 
> them as a map:
> 
> (defn get-config
>   []
>   (check-config)
>   {
>:dbtype "mysql"
>:dbname (System/getenv "DATABASE_NAME")
>:user (System/getenv "DATABASE_USER")
>:password (System/getenv "DATABASE_PASSWORD")
>:host (System/getenv "DATABASE_HOST")
>})
> 
> This is used simply:
>   ds (jdbc/get-datasource  (get-config))
> 
> I've checked the environment values several times and they are correct. But 
> when the code tries to write to the RDS database, I get: 
> java.sql.SQLException: Access denied for user 
> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
> ' (using password: YES)
> 
> I am connecting to the Internet through Spectrum, and apparently "rr.com 
> " is Spectrum. I'm confused, why would next.jdbc use this 
> info? Did I forget some important value in the hash map? 
> 
> From my laptop, I can reach the RDS database using the MySQL CLI, so there 
> are no problems with connectivity. I whitelisted the IP address of my house. 
> This is something specific about what next.jdbc needs in that hash map, I 
> think.
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com 
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+u...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/eadd7b66-d19d-41e8-b02d-76185de0778dn%40googlegroups.com
>  
> .
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/9e58a686-29fb-43d4-af41-2cf0345425c6n%40googlegroups.com
>  
> .

-- 
You received this message because you 

Re: Ruby on Rails similar functionality for auto-generating an API?

2022-01-08 Thread Orestis Markou
Hi,

I’m not sure it’s a 100% match of what you want but https://coast.swlkr.com/ is 
a recent attempt at a full stack framework. Perhaps it will be useful. 

Best,
Orestis

> On 8 Jan 2022, at 6:27 AM, Laws  wrote:
> 
> In Ruby on Rails, given an existing database, it is very easy to 
> autogenerate much of the code needed to serve a simple RESTful API. Does the 
> Clojure ecosystem have anything like that? 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/383a6a55-7f11-439d-b8a0-cd09a61dee9fn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/F482A944-46A7-4330-A211-5344E226CF0B%40orestis.gr.


Re: Routing for a non-web-app

2021-04-19 Thread Orestis Markou
As far as I know, reitit could probably do what you want. It works on 
ClojureScript too.

> On 19 Apr 2021, at 01.58, Blake Watson  wrote:
> 
> Howdy,
> 
> Writing a desktop app and thinking describing routes is the way to go, as far 
> as setting up the flow through the program. There are quite a few Clojure 
> routing libraries but most seem to assume it's a web backend (naturally), and 
> the ones that don't seem to be ClojureScript (which I can't use here).
> 
> I could just use a multi-method and roll my own, of course, but I thought it 
> might be useful to try out an existing library.
> 
> ===Blake===
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/CAJAnwPnBTuHsbDA_OgGSAt1j_B_tL%2B%3DnCVsigwZrAzD_g9%3D%2BsA%40mail.gmail.com
>  
> .

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/DEF9D4FD-EE14-4855-BB97-A9297DC9DD97%40orestis.gr.


Re: first time without state - and I'm lost

2020-05-12 Thread Orestis Markou
I’m interested in this too — you can get inspiration from 
https://github.com/cognitect-labs/aws-api/blob/master/src/cognitect/aws/credentials.clj
 

 which does something similar for expired credentials. Seems like a mutable 
internal field is fine for this use case.

> On 12 May 2020, at 9:27 AM, Scaramaccai  wrote:
> 
> Hi everyone,
> 
> I wanted to give a try to Clojure and functional programming in general but I 
> can't really stop thinking "object oriented" or "with state everywhere". 
> After 20+ years with objects + state I guess I'm lost without them :)
> 
> The first thing I want to try is to get some data from an API that needs 
> OAuth authentication. I would like to hide the fact that there's an OAuth 
> token to be sent. In pseudo-Java I would do something like:
> 
> class MyAuthHttpClient {
>   private token;
>   public MyAuthHttpClient(String usr, String psw) {...}
> 
>   public ... getResponse(Url) {
>   // here check if token is available and if it is expiring;
>   // if expiring -> fetch a new token before call the http service
>   // caller doesn't even know there's a token involved in the process
>   }
> }
> 
> What's the proper way to do that in Clojure?
> I guess one way would be to have a function that returns a new token given a 
> (possibly old) token and user+psw
> 
> (defn gettkn [usr, psw, tkn] (return a new token if tkn is expiring or tkn if 
> not expiring))
> 
> (def wrap-gettkn (partial gettkn "myuser" "mypass"))
> 
> (defn geturl [url, tkn] client/get url {:oauth-token (wrap-gettkn tkn)})
> 
> 
> I can "save" usr and psw, but I always have to "keep" the tkn around at every 
> level;
> while I would like the token to be "hidden" to the "geturl" clients (just 
> like I did in the "private token" in the pseudo-Java).
> 
> What's the proper way of doing something like this in Clojure?
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/6aa66613-24d9-4ebc-87d4-e9a6cca05165%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/7C785215-2169-461D-917F-0605F30B0154%40orestis.gr.


Re: Component question/advice

2019-09-16 Thread Orestis Markou
I did something similar for a database connection component, that could connect 
to multiple databases at runtime and had to maintain internal state. I didn’t 
need to make the individual connections components, but this was because the DB 
driver handles state internally. 

In my case I used an atom hidden behind a protocol to keep track of already 
instantiated connections. 

Hope this helps. 

Thanks,
Orestis

16 Σεπ 2019, 10:36 μμ, ο χρήστης «Don Jackson » 
έγραψε:

> Hello,
> 
> I'm writing an app/system that subscribes to a number of feeds, the number 
> and configuration of the feeds is a configurable run-time thing.
> Seems like I should have a Feed component, which is passed its config when 
> instantiated.
> But having a named slot in the system for each feed would be painful and 
> kinda defeats the point of having a variable number of feeds that get 
> configured.
> 
> How best to deal with this in Component?
> 
> One thought I had was to create a Feeds (note plural, trailing s) component.
> The Feeds component would be instantiated with a collection of feed configs, 
> and would have a single slot to hold the collection of instantiated feeds.
> This Feeds component would instantiate a Feed component for each feed, and 
> could start/stop them in its own start/stop methods.
> 
> I appreciate/understand that my individual Feed components would not be 
> participating in the System dependency injection, but AFAICT they don't need 
> to.
> 
> The above seems like it would work fine, but also seems like it is not 
> idiomatic Component.
> 
> I would welcome any thoughts/advice as to how best to structure this with 
> Component.
> 
> Thanks
> 
> Don
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/0caae21e-b7c0-422f-a157-15c535c84022%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/94223F7B-C095-45C0-B1F0-F35DEDC419B4%40orestis.gr.


Re: [ANN] Clojure 1.10.1-beta1

2019-03-31 Thread Orestis Markou
I think the issue you are seeing is because you need to wrap the require form 
in a vector:

(:require [trybeta.foo :refer :all])

Thanks,
Orestis

31 Μαρ 2019, 4:19 μμ, ο χρήστης «Rakhim Davletkaliyev » 
έγραψε:

> Hi Alex,
> 
> With this beta + ClojureScript (v. 1.10.238), when trying to "refer all", 
> like so:
> 
> (:require trybeta.something :refer :all)
> 
> I get the following error:
> 
> clojure.lang.ExceptionInfo: Only [lib.ns & options] and lib.ns specs 
> supported in :require / :require-macros; offending spec: :refer at line 1 
>  {:file "", :line 1, :column 1, :root-source-info 
> {:source-type :fragment, :source-form (ns trybeta.core (:require 
> trybeta.something :refer :all))}, :tag :cljs/analysis-error}
> 
> This is much better than "Don't know how to create ISeq from: 
> clojure.lang.Keyword" error present in previous versions!
> 
> While I completely agree that "require all" is bad style and should not be 
> used, I think the error message could be a bit more specific still, 
> considering "refer all" is quite widespread in tutorials/examples, and 
> beginners like myself tend to try to use it when transitioning from Clojure 
> to ClojureScript.
> 
> Maybe, isolate and display the offending part?
> 
> I apologize if this suggestion is irrelevant, as I am out of my depth when it 
> comes to core Clojure and spec.
> 
> Thank you!
> 
>> On Friday, 22 March 2019 06:35:32 UTC+2, Alex Miller wrote:
>> 1.10.1-beta1 is now available. You can try it with clj using:
>> 
>>   clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version 
>> "1.10.1-beta1"}}}'
>> 
>> 
>> 1.10.1-beta1 includes the following changes since 1.10.0:
>> 
>> CLJ-2484 - Fix Java performance regression loading user.clj
>> CLJ-2463 - clojure.main uncaught exception handling
>> CLJ-2491 - Fix fragile tests that fail under Java 12
>> The issue in CLJ-2484 was introduced in Java itself, specifically Java 1.8 
>> u202, Java 11.0.2, and Java 12. It primarily affects loading of user.clj and 
>> can cause a significant load time difference for anything done in user.clj. 
>> CLJ-2463 affects how errors are reported from clojure.main. This includes 
>> many Clojure uses under tools like Leiningen, such as compile, test,  etc.  
>> 
>> We would greatly appreciate feedback if you could check out this release in 
>> your own project and give it a try!! 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Google Summer of Docs

2019-03-14 Thread Orestis Markou
Google just announced “Summer of Docs” — from their Twitter:

> Announcing Season of Docs, a new program that connects technical writers with 
> open source projects!

> We hope Season of Docs will help technical writers get into developer 
> documentation, while also helping open source projects improve their docs. 
> https://opensource.googleblog.com/2019/03/introducing-season-of-docs.html

I thought it might be interesting to the list, so here we go :)

Best,
Orestis

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using map to produce side effects, not working

2019-02-07 Thread Orestis Markou
Without having ran your code, it seems that the inner map is not wrapped in a 
doall, so while the outer lazy-seq is forced, the inner is not.

This might be of interest to you: 
http://clojure-doc.org/articles/language/laziness.html 


If you only want to do map for side effects, you could use dorun instead of 
doall.

> On 7 Feb 2019, at 12:04 PM, Pierpaolo Tofani  
> wrote:
> 
> Hi
> i am new in clojure sorry. 
> In the snippet of code i used two map functions only to produce side effects 
> on two ref. 
> Even using doall no affect is produced on ref aaa and zzz, seems that the 
> sequence is still lazy.
> But if i remove the final :done , and the repl show me the sequence produced 
> (that i don't care) the ref aaa and zzz are affected.Thanks in advance.
> PS The two map are in effect doing a for.
> 
> (def aaa (ref 0))
> (def zzz (ref 0))
> (def s1 [1 2 3 4 5])
> (def s2 [1 2 3 4 5])
> (defn make-side []
> (do   
> (doall   
> (map
>   (fn [x]
> (map
>   (fn [y]
> (dosync
>   (alter aaa inc)
>   (alter zzz dec)
> )
> )
>   s2))
>   s1)
> )
> :done
> )
> )
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] com.walmartlabs/lacinia 0.31.0 and com.walmartlabs/lacinia-pedestal 0.11.0

2019-01-07 Thread Orestis Markou
Thanks! Don’t worry about breaking changes the spec itself is evolving so at 
least I have resigned myself to some breakage down the line. Very happy to hear 
about JVM 11 compatibility!

7 Ιαν 2019, 7:43 μμ, ο χρήστης «Howard Lewis Ship » έγραψε:

> Lacinia is an open-source implementation of Facebook's GraphQL specification, 
> in Clojure.
> 
> GraphQL is an outstanding approach to getting diverse clients and servers 
> exchanging data cleanly and efficiently.
> 
> GitHub repo:  https://github.com/walmartlabs/lacinia
> 
> Documentation: http://lacinia.readthedocs.io/en/latest/
> 
> Featured changes in 0.30.0:
> 
> - Limited support for custom directives
> - Ability for field resolvers to provide extensions or warnings along 
> with/instead of a value
> - BREAKING CHANGES to simplify/improve custom scalars
> - Fixed nils getting promoted into empty lists
> - Fix compatibility with Clojure 1.8 and with JDK 11
> 
> 
> lacinia-pedestal provides the Pedestal support to expose web endpoints backed 
> by Lacinia's GraphQL.
> 
> GitHub repo: https://github.com/walmartlabs/lacinia-pedestal
> 
> Documentation: http://lacinia-pedestal.readthedocs.io/en/latest/
> 
> Featured changes in 0.11.0:
> 
> - Update to GraphiQL 0.12.0
> - Fix Clojure 1.8 compatibility
> 
> -- 
> Howard M. Lewis Ship
> 
> Senior Mobile Developer at Walmart Labs
> 
> (971) 678-5210
> http://howardlewisship.com
> @hlship
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How does Executors/newScheduledThreadPool know how or where to parallelize work?

2019-01-02 Thread Orestis Markou
If you call future, you will be using the future threadpool which is unbounded. 
If you know there’s always going to be a small amount of tasks in-flight, you 
can safely just use future to parallelize your work, and the scheduled executor 
to trigger trigger the work periodically. 

Have a look at https://github.com/TheClimateCorporation/claypoole as well. 

3 Ιαν 2019, 12:23 πμ, ο χρήστης «Matching Socks » έγραψε:

> You are right, this is not a Clojure question. I suppose your scheduled task 
> could put a bunch of tasks on a queue and a thread-pool executor could work 
> the queue in multiple threads.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] clj-commons - an org

2018-11-11 Thread Orestis Markou
Thank you for the initiative, I think it is very valuable.

It would be ideal if this gets its own website should that it starts to get 
some Google juice. Also, managing to add some note to the original repo would 
be super helpful, if at all possible. 

Finally, consider applying for Clojurists Together funding for this - it’s 
thankless work but extremely important. 

Perhaps a meta-repo would be useful that describes the rationale? Then we can 
help with copywriting, pull requests, etc etc. 

11 Νοε 2018, 12:25 μμ, ο χρήστης «Erik Assum » έγραψε:

> Hi all, 
> 
> Letting the cat out of the sac.
> 
> I’ve created a GitHub organisation, https://github.com/clj-commons. 
> With a name like that, one could imagine many raisons d’être, but for now, 
> the main reason is to
> give a home to useful Clojure libs/projects which for various reasons are no 
> longer maintained.
> 
> I’ve taken the liberty to fork the latest fork of secretary 
> https://github.com/gf3/secretary,
> to ensure that it continues to work with the latest version of Clojurescript. 
> This is now available from Clojars at [clj-commons/secretary “1.2.4”]. Issues 
> and PRs are more than welcome 
> at https://github.com/clj-commons/secretary
> 
> If you know of libs/projects that are in need of some TLC, if you’re the 
> author of a lib/project that
> you’re no longer wanting to maintain, please give me a ping.
> 
> If the amount of libraries maintained by clj-commons increases, I’ll also be 
> looking for co-maintainers.
> 
> Happy hacking!
> 
> Erik.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure

2018-09-26 Thread Orestis Markou
Perhaps this talk would be useful to you?

Tom Faulhaber - Creating Beautiful Spreadsheets With Data and Templates

https://www.youtube.com/watch?v=qnJs79W0BDo 



> On 26 Sep 2018, at 9:24 AM, venkata sai  wrote:
> 
> can anyone know how to autogenerate code in clojure from csv file. i have a 
> template such that by using macros we can convert that into a template.. i 
> donot know hoe to do it. anyone help me
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: IF, WHEN or SOME

2018-09-20 Thread Orestis Markou
evens? is not a macro, therefore when you do (evens? (println “one”)), the 
println will be evaluated first, and its return value, nil, gets passed into 
the evens function. 


20 Σεπ 2018, 5:44 μμ, ο χρήστης «Stephen Feyrer » 
έγραψε:

> Hi,
> 
> I have just been playing around with this idea and I got something.
> 
> user=> (def some-numbers ‘(2 4 6 8))  #This is my value to test later.
> #’user/some-numbers
> user=> (def evens? (partial (when (apply = (map even? some-numbers)
> #’user/evens?
> user=> (evens? (println “one”))
> one
> NullPointerException   user/eval239 (NO_SOURCE_FILE:74)
> user=> 
> 
> What is my mistake?
> 
> Thanks.
> 
> 
>> On 12 December 2017 at 07:52, Stephen Feyrer  
>> wrote:
>> Hi Tim,
>> 
>> Thank you.
>> 
>> 
>> --
>> Kind regards
>> 
>> Stephen.
>> 
>>> On 11 December 2017 at 23:58, Timothy Baldridge  
>>> wrote:
>>> I talked a bit about this in my video on Boolean Blindness: 
>>> https://www.youtube.com/watch?v=K1LaaJMscCc
>>> 
>>> Might be worth a watch. 
>>> 
 On Mon, Dec 11, 2017 at 4:56 PM, Stephen Feyrer  
 wrote:
 Hi there,
 
 I have been trying to shake this thought for a while now.  Essentially, my 
 thought was if you can return a function why not decision component of an 
 IF, WHEN or SOME statement?  That would give you a re-usable named choice.
 
 Then you could write:
 
 (celebration: do-something do-something-else)
 
 
 This would be equivalent to writing:
 
 (def success [apples bananas pears])
 
 (defn celebration: [x y] (if (empty? success) x y))
 
 (celebration: (do-something do-something-else))
 
 
 I'm reasonably certain of the foolishness of this thought but 
 occasionally, I have doubts.
 
 Maybe I'm barking up the wrong tree or possibly I've seen something like 
 this before and forgotten about it.  Perhaps, this is just taking things 
 too far...  Either way, it's deferring the choice until it's needed.  In 
 the right hands it could make for more readable code.
 
 For completeness sake, to define the first form above you'd use:
 
 (defc celebration: (if (empty? success)))
 
 
 A more usable example might look like:
 
 (def nums [1 2 3 4 5 6 7 8])
 
 (defc even-nums: (some (even? nums)))
 
 I guess this makes the real question, is it a good thing to be able to 
 defer choice like this?
 
 
 Btw, defc would be like def-choice but other options might be deft - 
 def-test or defp - def-predicate.
 
 
 --
 Kind regards
 
 Stephen
 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
>>> 
>>> 
>>> 
>>> -- 
>>> “One of the main causes of the fall of the Roman Empire was that–lacking 
>>> zero–they had no way to indicate successful termination of their C 
>>> programs.”
>>> (Robert Firth)
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with 
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> 

Re: IF, WHEN or SOME

2018-09-20 Thread Orestis Markou
In addition, when is a macro, so I don’t think you can call partial on it :)

20 Σεπ 2018, 5:44 μμ, ο χρήστης «Stephen Feyrer » 
έγραψε:

> Hi,
> 
> I have just been playing around with this idea and I got something.
> 
> user=> (def some-numbers ‘(2 4 6 8))  #This is my value to test later.
> #’user/some-numbers
> user=> (def evens? (partial (when (apply = (map even? some-numbers)
> #’user/evens?
> user=> (evens? (println “one”))
> one
> NullPointerException   user/eval239 (NO_SOURCE_FILE:74)
> user=> 
> 
> What is my mistake?
> 
> Thanks.
> 
> 
>> On 12 December 2017 at 07:52, Stephen Feyrer  
>> wrote:
>> Hi Tim,
>> 
>> Thank you.
>> 
>> 
>> --
>> Kind regards
>> 
>> Stephen.
>> 
>>> On 11 December 2017 at 23:58, Timothy Baldridge  
>>> wrote:
>>> I talked a bit about this in my video on Boolean Blindness: 
>>> https://www.youtube.com/watch?v=K1LaaJMscCc
>>> 
>>> Might be worth a watch. 
>>> 
 On Mon, Dec 11, 2017 at 4:56 PM, Stephen Feyrer  
 wrote:
 Hi there,
 
 I have been trying to shake this thought for a while now.  Essentially, my 
 thought was if you can return a function why not decision component of an 
 IF, WHEN or SOME statement?  That would give you a re-usable named choice.
 
 Then you could write:
 
 (celebration: do-something do-something-else)
 
 
 This would be equivalent to writing:
 
 (def success [apples bananas pears])
 
 (defn celebration: [x y] (if (empty? success) x y))
 
 (celebration: (do-something do-something-else))
 
 
 I'm reasonably certain of the foolishness of this thought but 
 occasionally, I have doubts.
 
 Maybe I'm barking up the wrong tree or possibly I've seen something like 
 this before and forgotten about it.  Perhaps, this is just taking things 
 too far...  Either way, it's deferring the choice until it's needed.  In 
 the right hands it could make for more readable code.
 
 For completeness sake, to define the first form above you'd use:
 
 (defc celebration: (if (empty? success)))
 
 
 A more usable example might look like:
 
 (def nums [1 2 3 4 5 6 7 8])
 
 (defc even-nums: (some (even? nums)))
 
 I guess this makes the real question, is it a good thing to be able to 
 defer choice like this?
 
 
 Btw, defc would be like def-choice but other options might be deft - 
 def-test or defp - def-predicate.
 
 
 --
 Kind regards
 
 Stephen
 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
>>> 
>>> 
>>> 
>>> -- 
>>> “One of the main causes of the fall of the Roman Empire was that–lacking 
>>> zero–they had no way to indicate successful termination of their C 
>>> programs.”
>>> (Robert Firth)
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with 
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit