2015-10-28
| 00:11 | WickedShell | With core.async channels is there a way to make a channel LIFO? (Goal here would be a LIFO slidding buffer on a channel) |
| 00:12 | WickedShell | I guess I could define my own buffer? I've never touched that aspect but thats the only way I've seen so far to accomplish that |
| 01:43 | xzilend | Is there a way to have tools.logging log calls be printed in a CIDER REPL? |
| 06:36 | jonathanj | are there any structured logging libraries for Clojure or Java that anyone would recommend? |
| 06:37 | jonathanj | (structured in the "produces something like JSON and retains hierarchical log structure" sense) |
| 06:38 | jonathanj | we use Eliot <https://eliot.readthedocs.org/> for our Python code and would like to reap the benefits of producing the same kind of logs everywhere |
| 06:42 | yenda | Is anyone here using compojure-api ? |
| 06:52 | powered | I'm using compojure because sente requires it |
| 06:56 | Deraen | powered: Sente doesn't require Compojure, examples just use it but you should be able to use any routing library to define the endpoints. |
| 06:57 | Deraen | yenda: Yes |
| 06:59 | yenda | Deraen: do you have a workaround when you are developping in local to get the validation of your swagger.json working ? |
| 06:59 | yenda | I get [{"level":"error","message":"Can't read from file http://127.0.0.1:3000/swagger.json"}], obviously because swagger.io validator can't access my local file |
| 07:01 | powered | well that's good news, another dependency that can be taken out |
| 07:07 | Deraen | yenda: I have never tried to validate my local swagger.json |
| 07:15 | kwladyka | What do you use to make configuration files for app? EDN and for example https://github.com/yogthos/edn-config? |
| 07:29 | kwladyka | i guess this one is the best https://github.com/sonian/carica |
| 08:33 | ikitommi_ | Yenda: this might be related - https://github.com/metosin/ring-swagger/issues/67 |
| 08:36 | ikitommi_ | -> "By default, Swagger-UI attempts to validate specs against swagger.io's online validator. ". That's an evil default IMO. But need a PR to allow overriding that in tje clj-side. And default to null. |
| 08:38 | ikitommi_ | I think we could shop own own swagger-validator and default to that. Validator already used in tests. |
| 09:06 | yenda | kwladyka_: I use environ |
| 09:06 | kwladyka_ | is any shortcut in Intellij to make test files in Clojure projects? |
| 09:07 | kwladyka_ | yenda, thx |
| 09:07 | kwladyka_ | i see weavejester makes it so it is probably good :) |
| 09:08 | yenda | I think it is the best if you intend to do more than a pet project and have it running in production someday |
| 09:08 | yenda | There is also propertied whore clojurewerkz which also use a plain java proprerties file |
| 09:09 | kwladyka | yenda, anyway i need make standalone java file and load data from config file on user computer |
| 09:09 | kwladyka | so user can modify config file |
| 09:09 | kwladyka | i am not sure it is good library for that? |
| 09:09 | kwladyka | config file is about SMTP authorisation etc. |
| 09:10 | yenda | if you want a plain java properties file it is probably better to use propertied |
| 09:10 | kwladyka | and i want have different data during test, then after compile file |
| 09:10 | yenda | because environ is more oriented towards profiles.clj in dev/test and environment variables in production |
| 09:10 | kwladyka | i am not sure how it is working... edn file can be like what i want? |
| 09:11 | kwladyka | and if i understand environ wouldn't work in that way but carica will work like that? |
| 09:11 | kwladyka | i am not sure |
| 09:11 | kwladyka | for now i am doing scratch project which will just work... after that i will verify details :) |
| 09:12 | yenda | kwladyka: use environ rather than karika |
| 09:12 | yenda | you just need a profiles.clj file |
| 09:12 | yenda | you put your profiles and variables like that {:dev {:env {:database-url "jdbc:postgres://localhost/dev"}} |
| 09:12 | yenda | :test {:env {:database-url "jdbc:postgres://localhost/test"}}} |
| 09:13 | yenda | and then call (env :database-url) |
| 09:13 | yenda | in prod you will have DATABASE_URL environment variable defined |
| 09:14 | kwladyka | it will also work as standalone uberjava file? |
| 09:14 | kwladyka | i am not sure how work profiles then |
| 09:22 | kwladyka | program will be running on user machine, not on server. It is dedicated to no technical people. Upload on server is to hard :) |
| 09:23 | kwladyka | so program has to read all files from local drive as uberjar |
| 09:50 | noncom | did anybody get into situation when maven leaves the "main" folder inside the jar and some inner folders, all of which are empty? |
| 11:07 | bluezone | Do people use IntelliJ for clojure? |
| 11:11 | powered | I use eclipse + counterclockwise |
| 11:13 | bluezone | I prefer not to go back to eclipse :D |
| 11:18 | powered | It's going to be 3 java VM instances either way lol |
| 11:23 | bluezone | lol |
| 11:23 | snowell | bluezone: I can vouch that cursive clojure makes intellij very nice for clojure development |
| 11:25 | kwladyka | I have all the time AuthenticationFailedException when using postal and gmail. Did you have this problem? |
| 11:25 | kwladyka | bluezone, i use UtelliJ, in my personal opinion it is the best solution. |
| 11:25 | kwladyka | But... i din't try myself others to be honest. |
| 11:27 | kwladyka | gmail suggest me i am trying to login with unsafe devices when use postal... |
| 12:23 | bluezone | kwladyka: I hate authentication problems :( Been trying 3 weeks to solve OAuth 2 problems lol |
| 12:35 | justin_smith | regarding "using compojure because sente requires it" above, this is false, I use sente without compojure just fine, all you need to do is assign sente's handlers to paths, the router you use does not matter |
| 12:42 | kwladyka | bluezone, i found it. google added additional security for non secure apps... i am wonder how they define not secure apps. |
| 12:42 | kwladyka | justin_smith, hi old friend :) |
| 12:43 | justin_smith | hello |
| 14:19 | kaladin | is core async reasonable to use for parallel computation of large datasets or am i using the wrong tool for the job? |
| 14:29 | hlship | Just curious how much traffic is still here on IRC, now that Slack has gone live. |
| 14:29 | hlship | Also, just getting LimeChat set up on my new Mac. |
| 14:29 | justin_smith | hlship: it's been less active, but there's still some traffic |
| 14:41 | Frozenlock | hlship: IRC is master race anyway :-p |
| 14:55 | SpookySpookyBoo | hlship: slack barely runs on my computer |
| 14:56 | SpookySpookyBoo | but im also connected to a few different teams |
| 14:56 | xemdetia | irc may also nicer depending on your corporate overlord regime |
| 14:57 | xemdetia | *also be |
| 15:04 | snowell | I have to be on a VPN fairly often that blocks IRC but NOT Slack |
| 15:04 | snowell | Figure that one out :| |
| 15:05 | Frozenlock | snowell: Could the VPN be killing any connection not on port 80 or 443? |
| 15:05 | snowell | It's the US Government, so anything's possible |
| 15:05 | amalloy | NSA operative confirmed |
| 15:06 | hiredman | you just need an web based irc client |
| 15:07 | snowell | hiredman: But that would be a change. I don't like that |
| 15:07 | hiredman | e.g. https://webchat.freenode.net/ |
| 15:07 | hiredman | slack would also be a change |
| 15:07 | snowell | shhhhhh |
| 15:12 | snowell | hiredman: Thanks. Trying the web thing out to see how it goes |
| 15:13 | hiredman | forcing everything to be tunneled over http is just the worst, what a world we have built |
| 15:13 | mnemnion | hi everyone. I'm using Luminus, and having trouble getting it set up so that it hot-reloads changed .clj files. Any tips? "lein run" doesn't appear to do it. |
| 15:20 | justin_smith | mnemnion: lein run does not cause hot-reloads, no, this is not a feature of lein |
| 15:21 | justin_smith | mnemnion: you can use the wrap-reload middleware from ring, that should cause your handlers to reload if changed when new requests come in |
| 15:24 | mnemnion | Thanks justin_smith |
| 15:27 | bendavisnc | anyone here have any suggestions between "the joy of clojure" vs "clojure for the brave and true"? |
| 15:27 | bendavisnc | i want to get into clojure i think after briefly looking at the little schemer book |
| 15:31 | didibus | In Clojure, can I refer to a Var in another namespace without importing the namespace? |
| 15:31 | justin_smith | didibus: without requiring it? yes you can, but usually it's a bad idea |
| 15:31 | bluezone | didibus: yes by doing namespace/varname (something like this) |
| 15:32 | justin_smith | didibus: circular namespace dependency? if so, bluezone 's suggestion will not help, resolve will work, and you are probably doing something all wrong |
| 15:34 | bluezone | I am a noob but this is what the author wrote in Living Clojure |
| 15:35 | justin_smith | bluezone: you can call it as namespace/varname but calling that way without requiring is sloppy - there's no advantage to it, and there are ways it can subtly break |
| 15:36 | bluezone | How does it break? So I don't fall into hole pls ^_^ |
| 15:36 | hiredman | any var that exists can in be referenced by its full name, but vars only exist when the code that creates them has been run |
| 15:36 | justin_smith | bluezone: when you call foo/bar without requiring foo, you are relying on the fact that some other namespace required foo already before you made that call |
| 15:37 | hiredman | so if you have a file that creates a var, trying to reference that var doesn't cause the file to be loaded |
| 15:37 | justin_smith | so if that other namespace changes, it could break your code, with no visible connection between the two namespaces |
| 15:37 | bluezone | isn't it smart enough to implicitly require foo when you do foo/bar? |
| 15:38 | justin_smith | bluezone: no, clojure's compiler is very stupid |
| 15:38 | justin_smith | intentionally |
| 15:38 | bluezone | Ah okay :) |
| 15:45 | didibus | Sorry my IRC disconnected. So I am calling an atom using @namespace/atom and not importing the namespace |
| 15:46 | didibus | In my REPL that works fine, but when I build it gives me a build error |
| 15:46 | hiredman | you don't import a namespace |
| 15:46 | didibus | compilation failed: java.lang.ClassNotFoundException |
| 15:46 | justin_smith | didibus: that only works accidentally, and only if some other code required the namespace |
| 15:46 | justin_smith | didibus: why wouldn't you just require the namespace? |
| 15:46 | hiredman | generally you'll use 'require' or 'use' (or :require and :use) |
| 15:47 | hiredman | both of those actually do multiple things |
| 15:47 | hiredman | the first thing is to look for a file the corresponds to the namespace name you asked for and load it |
| 15:47 | didibus | It's only at the end of my namespace, I've got some things def just for REPL conveniance to test the functions in my namespace, so I don't really need anything when running as an app |
| 15:48 | didibus | Is there a function or macro to just load a file? |
| 15:48 | hiredman | didibus: why not use require? |
| 15:48 | justin_smith | didibus: what's wrong with require? why do you hate it so? |
| 15:49 | hiredman | you will be effectively reimplmenting it |
| 15:49 | didibus | Hum, I'm fine with require, I just don't want to have it look like the namespace is required, it's only required for the things I've defined at the bottom that are only conveniances to setup things so you can call the functions from the REPL |
| 15:49 | justin_smith | didibus: the real fix is to take that shit out of the namespace |
| 15:50 | justin_smith | it's either required or not |
| 15:50 | hiredman | didibus: sounds like those belong in a different namespace |
| 15:50 | hiredman | if you have a grouping of functions that you want to distinguish from another group of functions, namespaces are a great way to do that |
| 15:51 | didibus | Hum, ya, I guess I could put that in a different namespace, load it in the repl when I need it and test my stuff through it. But have nothing require that namespace. Ok, thanks everyone, that will work |
| 15:52 | didibus | It's basically because my namespace has a lot of functions with takes a client object, and do remote calls with it. When I work on the namespace, creating that client is very verbose, have to setup a lot of stuff. So I had a function in the namesapce that setup a test client. |
| 15:52 | didibus | Would only use it in the REPL to quickly create the client |
| 15:53 | didibus | But, I'll just move that stuff in it's own namespace |
| 16:02 | kenrestivo | if a future isn't completed before -main exits, will the process wait or will the threads die? |
| 16:04 | kenrestivo | i guess i could find a way to kick them all back up to some function that needs to return before -main does, and deref all the futures |
| 16:07 | justin_smith | kenrestivo: the process will wait, unless you call (shutdown-agents) or (System/exit N) (where n is an int) |
| 16:09 | justin_smith | kenrestivo: usually this comes up because someone is like "why does -main hang instead of exiting at the end" and the answer is "somebody used the thread pools, and you need to use shutdown-agents and/or System/exit to make it exit) |
| 16:09 | justin_smith | s/)/" |
| 16:12 | kenrestivo | great, thanks justin_smith |
| 16:16 | kenrestivo | c |
| 17:25 | leika | Does anyone know if clojure-mode (for Emacs) exposes a way to turn off font-locking for symbols defined in clojure.core? |
| 18:05 | irctc | Hi everyone. :) |
| 18:06 | irctc | Can anyone tell me how to display text that just says Loading... while my backend async process fetches the results for the user? I'm using compojure. |
| 18:07 | justin_smith | irctc: sounds like something I would do in cljs / js |
| 18:07 | justin_smith | irctc: render "loading" into the page from the server, run a process in the browser that eventually replaces that text |
| 18:07 | irctc | So you are recommending that I do this in Clojure Script? |
| 18:08 | justin_smith | irctc: unless you have another idea of how "loading" on a web page would be replaced by page contents - this is usually done via frontend scripting |
| 18:08 | irctc | My idea was to create two threads so that one is loaded before the other one is ready. |
| 18:08 | irctc | But I was thinking in terms of just plain clojure. |
| 18:09 | justin_smith | irctc: threads? |
| 18:09 | justin_smith | irctc: there are no threads in the browser |
| 18:09 | irctc | Yes, I want to create an asynchronous process. |
| 18:09 | justin_smith | right, you want js or cljs for that of course |
| 18:11 | irctc | So would I just point my view to the cljs function which would then create the two processes and display the one that says Loading... until the other one is ready? |
| 18:15 | justin_smith | irctc: right, but how this is done in the details would vary based on what frontend DOM management you use (I recommend something react based, I use reagent at work, om-next looks great) |
| 18:18 | irctc | I've heard about reagent before. It was recommended. I'll probably use that. Thank you for your advice. I appreciate it. :) |
| 18:19 | justin_smith | irctc: I really wish this was just one simple thing, but it's amazing the amount of complexity under the hood for "simple" things that people expect from web pages these days :) |
| 18:20 | justin_smith | this would all be so much easier if everyone would drop the www and go back to gopher |
| 18:21 | irctc | I realize it's not going to be very easy to do, but I am open to a new experience. :) I don't know much about gopher so I can't comment on that. :) |
| 18:21 | justin_smith | irctc: gopher is old, and text only, and had no client side scripting, and no images, and no text formatting |
| 18:22 | justin_smith | you would get directories, and in those directories you get files or links to other directories on other servers - and that's it |
| 18:22 | justin_smith | so much simpler! |
| 18:23 | irctc | Maybe from our perspective (people who are used to a text based user interface), but for the majority of people it is much more intuitive to use a graphic based UI. |
| 18:23 | irctc | Besides, our industry has been enriched by all these new technologies. |
| 18:23 | noncom|2 | yeah.. gopher +1... and fido1 |
| 18:24 | WickedShell | Is there is a LIFO channel mechansim for core.async? Or is that something that would need to be done via a new Buffer impl? |
| 18:24 | noncom|2 | ah, if only this wonderful graphical uis were well standardized and straightforward to use |
| 18:25 | noncom|2 | html is not bad, but javascript alone is a hell |
| 18:25 | irctc | I think that's just a dropping-buffer. |
| 18:25 | irctc | It discards messages on a LIFO method. |
| 18:26 | irctc | I agree about the standards part. So many things in the world would be simpler if only they were standardized. For example the measuring systems. |
| 18:27 | WickedShell | I want the channel to behave in a LIFO method though thats not what dropping buffer does? |
| 18:27 | justin_smith | WickedShell: you should be able to make your own "channel" by implementing the protocol core.async uses right? |
| 18:28 | WickedShell | justin_smith, yeah i suspect thats what I need to do. Never done it before, and I kinda was surprised I couldn't find one that behaved that way |
| 18:29 | WickedShell | But I should be able to do it. I actually think I can do it by implementing a new buffer strategy |
| 18:29 | justin_smith | WickedShell: what about a very small sliding buffer? |
| 18:29 | WickedShell | justin_smith, right so sliding buffer drops messages the way I want, but taking from it doesn't behave in a LIFO manner, the takes are still FIFO |
| 18:30 | irctc | WickedShell, I would love to help you more but I am also very new at core.async. |
| 18:30 | WickedShell | All the channel's/buffer's I've found are all FIFO when pulling from the buffers |
| 18:31 | noncom|2 | yeah, afaik they're all fifo |
| 18:31 | noncom|2 | coz they are made to pipe messages |
| 18:31 | noncom|2 | it's pipes from CSP |
| 18:32 | noncom|2 | so look no further, just try to implement a lifo buffer! |
| 18:33 | WickedShell | Just wanted to confirm that was the approach before reinventing the wheel :) |
| 18:33 | noncom|2 | also, that will a bit contradict to core.async dogma i think |
| 18:33 | WickedShell | Er reimplementing... |
| 18:33 | WickedShell | Oh? How come? |
| 18:33 | noncom|2 | coz one of the core features of core.async is controlling backpressure |
| 18:33 | noncom|2 | imagine you have 2 puts and 2 reads. the elements lying on the bottom will never be taken from there |
| 18:34 | noncom|2 | now the put becomes 1 message and take is still 2 - the buffer gets emptied |
| 18:34 | noncom|2 | whatever that means, is that you have very little predictable behavior |
| 18:34 | noncom|2 | it's not like that for fifos |
| 18:35 | noncom|2 | i am no pro of course with core async, but you should have a *really* specific case if you need core async lifo somewhere in your design |
| 18:35 | WickedShell | Hm... The reason I'm looking for it is I have a single source that generates a list of needed results that multiple workers are working on, but if the user has moved to a new region I need to prioritize the work for the region that they are looking at. But the prior work is still valid and should be done if possible. But theres a really bad noticable latency problem if I simply work through the fifo buffer |
| 18:36 | noncom|2 | hmmmmmmm i just have no clue why would you use core async channels as events storage here... |
| 18:37 | noncom|2 | you *could* use them to communicate to the storage, be it implemented somehow else, say, some rotating mechanism with java.concurrent things/queues... |
| 18:38 | noncom|2 | with a dispatcher and stuff |
| 18:38 | noncom|2 | just remember, core async is about realtime comms |
| 18:38 | irctc | Off to bed. Take care everyone. :) |
| 18:38 | noncom|2 | have you read CSP? maybe you will find it interesting |
| 18:39 | noncom|2 | irctc: good night! |
| 18:39 | justin_smith | WickedShell: sounds like a prio-queue based channel |
| 18:39 | WickedShell | I have not read CSP or prio-queue. |
| 18:39 | noncom|2 | i read like 5 pages of CSP |
| 18:40 | noncom|2 | really enjoyed it |
| 18:41 | noncom|2 | justin_smith: are there any good implementations of priority queues for c.a? |
| 18:41 | noncom|2 | i google only that people talk about it... |
| 18:41 | noncom|2 | but not some actual solutions... |
| 18:41 | justin_smith | noncom|2: I really have no clue, but it just sounded like what he wanted was a channel backed by a prio-queue instead of a normal queue |
| 18:42 | noncom|2 | yeah, maybe.. idk, it's new to me |
| 18:42 | noncom|2 | here's a nice article http://dzimchuk.net/post/a-sample-implementation-of-a-priority-queue-based-on-azure-service-bus |
| 18:42 | noncom|2 | not for c.a though |
| 18:42 | noncom|2 | but has some theory and code |
| 18:42 | WickedShell | yeah priority, where increasing priority goes to newest things. Thus its monatomically increasing priority (which is essentially LIFO) |
| 18:44 | WickedShell | I have to read up on deftype/protocols though thats all new to me |
| 18:44 | noncom|2 | WickedShell: hmmm what about the problem that the bottom of a lifo stack can be reached in a year? |
| 18:44 | WickedShell | well I want to maintain the drop properties on the buffer size |
| 18:44 | noncom|2 | ah |
| 18:44 | WickedShell | The reality of my application anyways is that once the result is to stale its not worth doing |
| 18:45 | noncom|2 | well, you also could issue a new channel for each new switching, so that your workers will gain new channel, but still remember the old one, and work on it when they have time |
| 18:45 | noncom|2 | that would be very c.a-ey |
| 18:45 | WickedShell | Not sure what you mean by a new channel for each switching... |
| 18:46 | noncom|2 | have a stack of channels |
| 18:46 | noncom|2 | just an idea |
| 18:46 | noncom|2 | wiorkers switch to new location, as you said - and you give them a new channel for that location events |
| 18:46 | noncom|2 | the old channel, however, is still available for reading |
| 18:46 | noncom|2 | but idk, that's just an idea |
| 18:47 | WickedShell | Still sounds like a LIFO with limited capacity would work best/easier... |
| 18:47 | noncom|2 | maybe |
| 18:47 | noncom|2 | well, then just try to implement it! |
| 18:47 | WickedShell | I am :D (well except when I stop to type here.... which is maybe to often) |
| 18:47 | justin_smith | WickedShell: protocols and deftypes are not super hard, but maybe try it with a defrecord first, those are easier than deftype and have good defaults |
| 18:48 | noncom|2 | WickedShell: also, regarding all the defrecord and deftype thing, here's a lifesaver clue: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/ |
| 18:48 | WickedShell | justin_smith, I was looking at this: https://tgk.github.io/2013/10/inspect-core-async-channels.html and it looked reasonable. But I was going to find some doc on whats actually happening there with the def's first |
| 18:49 | justin_smith | WickedShell: make a custom function that creates an instance, that puts the underlying stack in a field of the record, then send just pushes onto the stack (which could just be conj on a list) and read polls or gets the first item (pops) etc... |
| 18:49 | justin_smith | WickedShell: ahh! so you don't need to define a channel, just a buffer, much easier |
| 18:50 | WickedShell | yeah once I saw the protocol of buffer it looked like a pretty easy job :) |
| 18:50 | noncom|2 | justin_smith: hmm.. how do you think, could such a buffer simply be an agent? |
| 18:50 | noncom|2 | w/o c.a |
| 18:50 | justin_smith | noncom|2: you don't need an agent, your buffer can be immutable |
| 18:50 | noncom|2 | ah |
| 18:50 | noncom|2 | yes |
| 18:50 | justin_smith | I mean you could ditch c.a and use an agent with a stack, maybe, but c.a has other advantages |
| 18:51 | noncom|2 | yeah |
| 19:17 | notid1 | is there a library that would make it possible to process clojure code as a datastructure? |
| 19:17 | notid1 | i'm trying to write something that will search a codebase for certain function calls |
| 19:20 | notid1 | kibit does something similar, but not exactly what I want |
| 19:21 | justin_smith | notid1: you could check out what eastwood does - it uses tools.analyzer |
| 19:21 | justin_smith | "search a codebase for certain function calls" is definitely a subset of what eastwood does today |
| 19:22 | justin_smith | (eg. it can figure out if a function is called with the wrong number of args) |
| 19:22 | notid1 | justin_smith: okay, that might be helpful |
| 19:22 | justin_smith | there is also slamhound, which is for refactoring |
| 19:23 | notid1 | cool. i'll check them both out. for reference, what i'm trying to do is build up a list of every value used as an argument for a few functions |
| 19:23 | notid1 | in the entire project |
| 19:24 | justin_smith | notid1: but not at runtime, just in the literal source? |
| 19:24 | notid1 | just the literal source, yes |
| 19:24 | justin_smith | because you could use robert.hooke at runtime to track args |
| 19:24 | justin_smith | cool |
| 19:31 | notid1 | justin_smith: slam.hound.aspload is exactly what i'm looking for. |
| 19:31 | notid1 | justin_smith: thank you! |
| 19:32 | justin_smith | awesome |
| 19:37 | neoncontrails | Heh. I love Clojure repository readmes, they're so... literary and metaphorical |
| 19:37 | neoncontrails | https://github.com/technomancy/slamhound |
| 22:26 | CharlesN | why this (mod (Math/pow 174 55) 221) returns 0.0 ?. The correct answer should be 47. |
| 22:40 | xeqi | ,(Math/pow 174 55) |
| 22:40 | clojurebot | 1.699059764806151E123 |
| 22:40 | CharlesN | , (mod (Math/pow 174 55) 221) |
| 22:40 | clojurebot | 0.0 |
| 23:11 | eze | hi, is there any gsoc 2016 posible mentor? |