Fork me on GitHub
#clojure-uk
<
2017-06-23
>
thomas07:06:29

morning 😼 mogge

guy08:06:11

I’m really enjoy this summer

guy08:06:19

been so lovely the last couple of days

thomas09:06:28

we had some heavy downpours last night and it has cooled down a lot now...

dominicm09:06:25

I'm still wearing shorts

guy09:06:44

yeah still shorts weather for sure

guy09:06:37

it would be cool if we could create an app/thing that would let us take the temperatures around us in our respective offices, then show them on a map.

guy09:06:01

Just a silly idea i thought of but it would be fun to do i reckon

guy09:06:51

You could literally create a heatmap of the uk 😄

dominicm09:06:55

I'm surprised something better doesn't already exist. I guess it's more of a toy than practical? Not gonna change as you go across the country really.

guy09:06:03

Yeah could be, maybe its a dumb idea. But having a more granular look at offices around the

guy09:06:05

yeah exactly

kevin4210:06:13

Do you mean temperature in the office or around the office?

kevin4210:06:30

If it's around the office there's https://www.wunderground.com/ where you can send your data.

dominicm10:06:40

@kevin42 can you query their data though, for your own analysis?

jasonbell10:06:58

@guy nice idea. Texas Instruments do a nice little IOT device with a load of sensors and that sends the data direct to IBM Bluemix platform, all the visuals are done for you. Not sure if you can mix others information coming in though.

guy10:06:25

mmm interesting, i was thinking just raspberry pi style

guy10:06:28

but that sounds cool

kevin4210:06:40

as far as I remember (this was 4-5 years ago) I think they have an api. The problem a long time ago is that it was missing data point in the UK and we wanted data in the world too.

jasonbell10:06:03

@guy I’ve done Pi/Ard stuff in the past with a DHT-22 temp/humidity sensor.

guy10:06:29

how was it?

guy10:06:34

was it hard to do?

jasonbell10:06:52

Not overly hard, Alasdair Allen did some good write ups on the Ardruino. Just gotta be careful with the 3v line. Readings were easy, it’s just case of where/how you’re going to send the data.

jasonbell10:06:16

Was done in Python on the Pi though and I never used the DHT there I’m afraid.

guy10:06:06

no worries thanks for the information!

otfrom10:06:12

@rickmoynihan always good to see the open data crowd. 🙂

yogidevbear10:06:24

Needs to work, but wants to Clojure. What a conundrum!

Sam H11:06:54

are you london based @yogidevbear ?

yogidevbear11:06:19

Nope, I live in Horsham (West Sussex)

yogidevbear11:06:31

About a 55min train journey from London Victoria

Sam H11:06:51

ah ok, our office is next to Mansion House tube station

Sam H11:06:12

extra 15 mins from Victoria station on circle/district

yogidevbear11:06:33

Do you live in London too?

Sam H11:06:09

brixton, which is about a 40 min door to door for me (though I have a 10/15 min walk to the station on brixton end)

yogidevbear11:06:05

That's nice in the summer months

Sam H11:06:21

aye lots of new stuff in the last few years

maleghast12:06:44

Context switching between Python and Clojure is not as hard as I expected it to be...

maleghast12:06:56

Hello everyone 🙂

otfrom12:06:47

python is just common lisp with poor syntax 😉

otfrom12:06:02

@dominicm not enough tabs

thomas12:06:34

last year I accidentally wrote (func arg1 arg2) in pycharm and it didn't complain about the syntax.... so it confused me for quite a while.

glenjamin13:06:59

you can write all of python inside tuples if you want

dominicm13:06:36

http://norvig.com/lispy2.html follow this, and then just write lisp again

dominicm13:06:39

life is better this way

maleghast13:06:40

@dominicm - I will have a look at that...

dominicm13:06:04

disclaimer, never done this! 😛

maleghast13:06:20

@dominicm - Looks fascinating, but it's not for now__...

dominicm13:06:53

pixi is cool, it's a shame it can't interop python

maleghast13:06:54

Yes, I thought the same thing when I looked at it, 'cos it is VERY cool.

maleghast13:06:26

But when I want to write Lisp I use Clojure and that can interop with Java, so I am going to assume it can interop with Jython as well..?

geek-draven14:06:13

I'm having a really weird issue with a csv, I can pull all the values out using get-in, apart from the date which is a date string, even if I copy a row out from the repl into the editor and def it, it still return nil. I tried not using keywords, and even renamed the field, but it still won't play ball

geek-draven14:06:45

this is the def

glenjamin14:06:09

that quote looks suspect

glenjamin14:06:46

probably unrelated, but i’m just surprised to see it there

glenjamin14:06:53

there’s no date in that example though

geek-draven14:06:05

I know, I changed it to bob

geek-draven14:06:28

sorry, it was one of the straws I was grasping at 🙂

geek-draven14:06:00

weird, it's not in my editor, even 'find' is returning nil. Thanks. I'll try running it in lein rather than proto repl and see if that makes a difference

geek-draven14:06:09

nope, lein is returning nil too

dominicm14:06:02

@geek-draven try (keys test-data) and (vals test-data).

geek-draven14:06:09

@dominicm this is what I get for (keys test-data)

dominicm14:06:49

"bob" is in there. How about vals? 🙂 Do you see the 06-…?

geek-draven14:06:31

also getting nil in http://tryclj.com too

dominicm14:06:57

@geek-draven how are you getting the key out?

geek-draven14:06:09

no, just the value

geek-draven14:06:31

(get-in test-data ["bob"])

dominicm14:06:54

I did (get test-data "bob") which worked. Didn't try get-in. Though wouldn't expect differing behaviour.

geek-draven14:06:37

still get nil with that in tryclj

dominicm14:06:15

> (get test-data "bob")
"06-05-2017"
> (get-in test-data ["bob"])
nil
> (get test-data "bob")
nil
woah, wtf

geek-draven14:06:47

have I broken Clojure 😞

dominicm14:06:16

> (keys test-data)
java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Var$Unbound

dominicm14:06:14

Give me some Clojure:
> (def test-data
    '{"store_name" "Leather Lane", 
        "net_sales" "2231.87", 
        "gross_sales" "2782.90", 
        "check_count" "321",
        "bob" "06-05-2017", 
        "promos" "36.50", 
        "comps" "88.65", 
        "tax" "0.00", 
        "guest_count" "328.00", 
        "payment" "2657.75"})
#'sandbox18953/test-data
> test-data
{"promos" "36.50", "comps" "88.65", "payment" "2657.75", "guest_count" "328.00", "store_name" "Leather Lane", "net_sales" "2231.87", "tax" "0.00", "gross_sales" "2782.90", "bob" "06-05-2017", "check_count" "321"}
> (keys test-data)
java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Var$Unbound

geek-draven14:06:36

I removed the quote from my def after @glenjamin mentioned it

dominicm14:06:28

the quote should make 0 differnece here 🙂

geek-draven14:06:42

yep, I'm getting the error now

dominicm14:06:45

don't trust the sandbox any more

dominicm14:06:02

right, works fine in my local repl (not tryclj)

dominicm14:06:22

wondering if we were sharing a namespace

dominicm14:06:59

If you do (def x) what is the var name?

dominicm14:06:05

Mine is 18953

geek-draven14:06:39

Mine is 19031

dominicm14:06:51

okay, cool 🙂

geek-draven14:06:04

I can values and keys from my local repl, but the get and get-in are both returning nil

dominicm14:06:08

Must persist across refreshes using a cookie or something

dominicm14:06:46

anyway, this is fucking weird

geek-draven15:06:26

I've spent the week parsing emails, pdfs and xlsx files, so thought a csv would be an easy Friday afternoon task 😄

glenjamin15:06:26

get works on some keys but not others?

glenjamin15:06:28

eugh, I guess /clj doesn’t play well with smart quotes

glenjamin15:06:45

anyway, i was wondering if it’s an issue with extra invisible chars

glenjamin15:06:51

but you said you renamed the key, so maybe not

glenjamin15:06:11

what about (get m (-> m keys (nth 4))) or whichever key

geek-draven15:06:45

Thank you, that works!

glenjamin15:06:05

that suggests weird characters in the string to me

geek-draven15:06:25

yes, might ignore the header row and write my own

dominicm15:06:29

clojure's = on strings does what?

dominicm15:06:41

"foo".equals("bar") it seems

geek-draven15:06:35

looks like it is weird characters, if I copy the key from the def and manually type 'bob' I get false

geek-draven15:06:27

Thanks for both your help