Fork me on GitHub
#hoplon
<
2017-01-14
>
thedavidmeister14:01:58

@alandipert run into a snag with local storage atoms

thedavidmeister14:01:19

getting an object like {0: "foo"} from a third party

thedavidmeister14:01:41

throws an error because of the round trip through read-string

thedavidmeister14:01:45

(cljs.reader/read-string (pr-str (js-obj 0 "a")))

micha14:01:32

you can't pr-str a js object

micha14:01:12

you need to do js->cljs before storing the value

thedavidmeister14:01:45

kk 1 sec i'll try that 🙂

thedavidmeister14:01:53

ah, i think i see what i was doing wrong @micha

thedavidmeister14:01:04

originally i was doing what you're suggesting but also using keywordize-keys

thedavidmeister14:01:12

it does not like 0 as a keyword

micha14:01:18

whoa really?

micha14:01:41

lol clojure syntax is so quirky

micha14:01:50

very unusual for a lisp

thedavidmeister14:01:55

(cljs.reader/read-string (pr-str (js->clj (js-obj 0 "a"))))

thedavidmeister14:01:07

(cljs.reader/read-string (pr-str (clojure.walk/keywordize-keys (js->clj (js-obj 0 "a")))))

micha14:01:39

i've found that keywordizing keys of json is a bad idea

micha14:01:47

in general

thedavidmeister14:01:56

well it's not json at that point

thedavidmeister14:01:02

it's a cljs something

micha14:01:15

yeah but keywordize keys breaks round tripping

micha14:01:18

things like that

micha14:01:25

i made that mistake in the adzerk backend

micha14:01:31

and it is still causing problems

thedavidmeister14:01:39

yeah i see that it would break a round trip back to json

thedavidmeister14:01:46

but i was surprised to see ^^ break

micha14:01:50

we are dealing with an api, too

micha14:01:13

so like {"FooBar": 100} in json becomes {:foo-bar 100} or something

micha14:01:00

also if you have references in the json that refer to keys of other objects

micha14:01:04

those will be values

micha14:01:09

so they aren't keywordized

thedavidmeister14:01:17

i'm like 5 or 6 levels deep in yak shaving right now

thedavidmeister14:01:27

all because they changed from an array to an object between lib versions

micha14:01:47

do you have any experience with electron btw?

micha14:01:09

i'm thinking about trying to make my own browser with it

thedavidmeister14:01:37

hah, only that i got one of my team at my last job to build some internal tools with it

thedavidmeister14:01:42

so only vicariously 🙂

thedavidmeister14:01:56

he said it wasn't too bad, was hooking up scala js to make a UI for a database encryption/decryption backend

thedavidmeister14:01:01

so you can do "real" things with it for sure

micha14:01:31

yeah i just want a browser with no nonsense

micha14:01:46

just something that can load a webpage and that i can make my own UI for

thedavidmeister14:01:03

i was really trying to get him to use hoplon with it at the time 😉

micha14:01:03

something like uzbl, which appears to be DOA

thedavidmeister14:01:25

i feel like they'd be a good match

micha14:01:43

yeah especially for a desktop app

micha14:01:13

the ui for a desktop app is well suited to the -tpls i think

thedavidmeister14:01:21

we were also considering hoplon + electron for an app to sit behind a touch screen for some IoT style devices

thedavidmeister14:01:40

@micha what's wrong with chrome though? too much stuff going on?

micha14:01:30

yeah it's too complicated, and you need plugins to get a sane UI

micha14:01:37

and i don't trust plugins too much

micha14:01:51

also i don't use tabs or any of the ui stuff

micha14:01:07

like i don't use the "chrome" in the UI

micha14:01:26

and the way chrome works i can't make keyboard work very well

thedavidmeister14:01:35

mmm, i'm a tab fiend

micha14:01:36

vimium is ok but has issues

thedavidmeister14:01:42

could not imagine living without them

micha14:01:49

i use the tabbed layout in i3

micha14:01:55

the i3 window manager

micha14:01:08

and i have a plugin that forces new tabs to open in a new window

micha14:01:48

it's a rube goldberg machine at the moment kind of but it's pretty nice having the tabs be window manager tabs rather than some special in-browser tabs

micha15:01:02

because i can use the i3 keybindings to switch tabs

micha15:01:11

or i can move a tab to a different workspace, etc

micha15:01:17

using the normal i3 commands

micha15:01:40

one thing i would like to have is a vi-like modal interface

micha15:01:47

where it has normal mode and insert mode

micha15:01:05

normal mode would not send any keypresses to the webapp

micha15:01:32

so my vim keybindings for browser stuff doesn't interfere with the webapp keybindings if they have those

thedavidmeister15:01:34

oh yeah, i see how that kind of standardises things

micha15:01:57

yeah i use the keyboard primarily, so keybindings are precious

micha15:01:33

have you seen uzbl?

micha15:01:44

it's a cool idea, but i think gtk3 screwed them over

thedavidmeister15:01:08

i had a look when you mentioned it before 🙂

micha15:01:36

they're now sort of forked now, with old working code that is on gtk2 with an older version of webkit, and new not-working code that is on gtk3 with new webkit

micha15:01:48

and old webkit is just not usable in the modern age

micha15:01:07

but the idea of it is great

micha15:01:21

the browser itself doesn't do anything but render a webpage

micha15:01:32

if you click on a link it sends an event on a fifo

micha15:01:52

and you can have a script that tells it to load a new url

micha15:01:13

when you download something it sends an event on the fifo, and you can use wget or whatever to download it

micha15:01:38

if you want an ad blocker you just use a squid proxy

micha15:01:42

same with the browser cache

micha15:01:46

cache it in squid

micha15:01:51

so simple

thedavidmeister15:01:03

mmm, but like you said, all the "rendering a page" stuff moves pretty fast

thedavidmeister15:01:12

need to be able to keep up with it somehow

micha15:01:15

yeah that's why i was thinking electron maybe

micha15:01:40

but i'm not sure how minimal the browsing experience can be with it

micha15:01:48

i think they wrap chromium

micha15:01:02

which does way more stuff

thedavidmeister15:01:06

well atom uses electron

thedavidmeister15:01:27

the "browsing" is invisible unless you go looking for it

micha15:01:31

yeah the BrowserWindow class is the thing i'd want

thedavidmeister15:01:30

oh, you're thinking if you go loading remote urls then bits of ui will start popping up?

micha15:01:32

also editing text areas in vim externally

micha15:01:49

not bits of ui i hope

thedavidmeister15:01:57

i'd be surprised if that was the case

micha15:01:00

but like caches and cookies and keybindings

thedavidmeister15:01:12

there are definitely keybindings

thedavidmeister15:01:34

but i think you can do things with them

micha15:01:41

mask them

micha15:01:50

before chromium sees them

thedavidmeister15:01:12

cmd + r definitely refreshed the browser when i was looking at what matt was doing with that database tool

thedavidmeister15:01:20

but it doesn't "refresh" atom

thedavidmeister15:01:46

but it does refresh slack

micha15:01:05

hopefully can mask those somehow

thedavidmeister15:01:13

so there's some mechanism you can override there

thedavidmeister15:01:30

hopefully it's not just the raw JS stuff

thedavidmeister15:01:48

because keyboard shortcuts in JS can be a pita

micha15:01:11

yeah but only if you need to be able to run on different platforms with different keyboard layouts 🙂

micha15:01:19

i only need it to work for my machine

thedavidmeister15:01:33

makes it a lot easier

micha15:01:39

it would be cool to have like macros too

thedavidmeister15:01:12

well i mean, you could make it do whatever you want

thedavidmeister15:01:19

i think postman is done in electron too

micha15:01:35

there are a few browser projects too

micha15:01:42

brave browser

thedavidmeister15:01:47

that seems like something pretty close to what you're looking for

micha15:01:48

and like 5 others

thedavidmeister15:01:57

but visual instead of the raw text

micha15:01:56

how do you mean?

micha15:01:18

maybe electron would be good to make a hoplon/ui ide too

thedavidmeister15:01:43

haha yeah that would be fun

thedavidmeister15:01:47

like a component maker

micha15:01:56

we were thinking that you could do osmething like this

micha15:01:18

like the actual deployed application would have some set of compiled components, defelems basically

micha15:01:40

the app talks to firebase when it loads to assemble the app from those components

micha15:01:02

the ui is designed in this ide and the assembly data stored in firebase

micha15:01:09

that would be completely separate from any backend you have

micha15:01:15

even if you use firebase as your backend

micha15:01:03

the "business logic" part of the frontend would run in a web worker or something that is loaded separately

micha15:01:20

so the ui code is separate from your code that talks to the backend

thedavidmeister15:01:41

you do want to make sure to support on/do as well as just defelem too

micha15:01:05

you'd wire those up in the ide

micha15:01:08

to each other

micha15:01:27

like the webcomponents pattern kind of

thedavidmeister15:01:22

i think it would be a challenge to get the right mix of being able to do everything and visual "magic"

micha15:01:38

the idea is to avoid visual magic

micha15:01:48

it's for business applications really

micha15:01:59

where you don't care about the latest artistic hotness

thedavidmeister15:01:11

mmm, the "wiring up" though

micha15:01:12

you need a simple UI with really excellent workflows

micha15:01:33

javelin i thnk makes that very simple

thedavidmeister15:01:50

but it doesn't really have a "UI"

micha15:01:06

the UI is assembled by composing existing components

micha15:01:17

that is to say appendChild basically

micha15:01:27

then you can wire up cells to attributes

micha15:01:33

or events to cells

micha15:01:54

each component would declare its attributes

thedavidmeister15:01:55

well yeah i know how to make a ui with javelin

thedavidmeister15:01:08

i mean, a ui to show what's going where with javelin

micha15:01:11

and you'd have a component designer in the IDE

micha15:01:26

which has the visual representation of the compoenent plus a worksheet tab

micha15:01:32

like a spreadsheet

micha15:01:40

where you can wire up the attributes to cells

micha15:01:44

or events to cells

micha15:01:10

and you could make local cells for a given instance

micha15:01:06

i guess it is going to be tricky to show what goes where

micha15:01:24

but like a spreadsheet though, i think there are ways

thedavidmeister15:01:27

i'm imagining something like what they do with audio/visual stuff

thedavidmeister15:01:54

where you literally drag out inputs and outputs into each other

micha15:01:07

yeah i've seen some of those, but they get too complicated for anything nontrivial

thedavidmeister15:01:11

like sticking leads into pedals 😛

micha15:01:27

like you open a little box and it's like a web of craziness

micha15:01:34

with like 100 things in there

thedavidmeister15:01:01

oh, well, i supposed you can't force people to be organised

micha15:01:20

i don't think they let you factor thinsg into functions like you can with javelin

thedavidmeister15:01:31

from what i've seen

micha15:01:33

that's how i manage complexity in javelin

micha15:01:00

if i have too many cells and it's hard to understand i will make a function that absorbs a bunch of formulas into one

micha15:01:05

and call that in the formula

thedavidmeister15:01:31

that's not really restricted to javelin

micha15:01:57

yeah i don't think that the sound processing things have that though

micha15:01:10

so they need to express everything as individual little cells

thedavidmeister15:01:54

a guy i used to work with moved out of web and into more of this audio stuff, but i really can't remember the names of the programs now >.<

thedavidmeister15:01:13

he said it wasn't really a big deal to switch between "wiring mode" and "editing the class" mode

micha15:01:14

i was watching a guy program one of those a while ago

micha15:01:20

it did not look ideal lol

micha15:01:33

he wasn't writing code though

micha15:01:42

he was like moving arrows around and stuff

thedavidmeister15:01:45

yeah see that's the thing

thedavidmeister15:01:56

if you can only do one or the other

thedavidmeister15:01:08

it's going to be a painful process, not really using the tool properly

micha15:01:12

yeah that's why spreadsheets get out of control

thedavidmeister15:01:24

but in audio you can see why it makes sense

micha15:01:34

visual basic is not usable really for spreadsheets very easily

thedavidmeister15:01:56

it's really like if you had cables and pedals, but you can write OO classes to replace "pedals"

thedavidmeister15:01:03

so you're inventing pedals and wiring them up

thedavidmeister15:01:16

which is what you're used to doing physically

micha15:01:47

yeah the problem is when they define a fixed set of pedals that are turing complete and then don't let you make your own pedals

micha15:01:56

so yes you can compute, but it's a mess

thedavidmeister15:01:03

yeah you have to be able to have both

thedavidmeister15:01:07

have you tried unity?

micha15:01:11

i have not

thedavidmeister15:01:23

that's similar, but without wires

thedavidmeister15:01:34

instead you get a 3d modelling tool to make a "world"

thedavidmeister15:01:48

and then you write your code into classes

micha15:01:54

entities i suppose

thedavidmeister15:01:58

and you drag and drop the classes onto your objects to make them do stuff

thedavidmeister15:01:23

and all the public properties show up in the UI as sliders and text fields and dropdowns

thedavidmeister15:01:05

so you're kind of "playing your game" while actually writing the code for it

micha15:01:24

that sounds pretty awesome actually

micha15:01:57

i don't see any reason why business webapps can't be made that way

thedavidmeister15:01:58

you can write the code in either JS, C# or some language they made up, from memory

thedavidmeister15:01:17

because then everyone would do it and we wouldn't have jobs 😉

micha15:01:41

we'd be working on backend functionality

micha15:01:59

making new features, making things more efficient to save costs, etc

thedavidmeister15:01:40

honestly, since i moved to hoplon and adopted clj on the front and backend

thedavidmeister15:01:49

most of the time i spend messing around with things is dealing with other people's stuff

micha15:01:56

yeah that's true

micha15:01:20

it's not like it used to be with crazy jquery webapps

micha15:01:37

spending days to figure out why this button sometimes doesn't do anything when you press it

micha15:01:41

or whatever

thedavidmeister15:01:35

"used to be" - company i worked for bought a crazy russian jquery web app sitting on jade/node templates about 2 months ago

thedavidmeister15:01:43

ppl are still doing it...

micha15:01:59

that's job security i guess

thedavidmeister15:01:19

if you're coming from the gross jquery world

thedavidmeister15:01:31

it takes some time to find, then learn both cljs and then hoplon

micha15:01:25

and there are so many things

thedavidmeister15:01:38

there are definitely many things

micha15:01:53

there are like hundreds of web frameworks

thedavidmeister15:01:27

there aren't that many truly different web framework approaches though

thedavidmeister15:01:26

just lots of people riffing on the same chords over and over

micha15:01:36

but most frameworks have lots of DSLs and other incidental complexity to learn

micha15:01:52

templates and controllers and whatnots

micha15:01:07

that's one thing i think we should update in the javelin docs

thedavidmeister15:01:14

<--- reformed drupal developer

thedavidmeister15:01:20

i know all about incidental complexity

micha15:01:24

have the docs concentrate on the javelin functions, not the macros

micha15:01:41

then show how the macros provide syntax sugar separately

thedavidmeister15:01:48

yeah, i'm in two minds about the docs

thedavidmeister15:01:55

on the one hand, they are generally *accurate*

micha15:01:19

like ((formula (fn [x y] (+ x y)) a b) vs (cell= (+ a b))

thedavidmeister15:01:23

on the other hand, it is hard to "get it" when you're coming from a JS framework background

thedavidmeister15:01:43

actually, the blog post on splint js really helped me

micha15:01:54

yeah you can't use macros in js

micha15:01:06

so the splint.js needs to use the functions only

thedavidmeister15:01:32

but the blog post specifically clearly shows moving through progressively less bad tactics to achieve the same thing

micha15:01:52

we should link to that blog post in the javelin readme

thedavidmeister15:01:52

^^ me graduating from jquery to hoplon/javelin 😛

micha15:01:00

nice owl dude

micha15:01:02

nailed it

thedavidmeister15:01:29

haha, i wish i could take the credit for that >.<

thedavidmeister15:01:26

when i first looked at javelin it was like "oh yeah, i can see how you can make 2 from 1 + 1, but can i really build a whole site with that?"

thedavidmeister15:01:45

for a really long time i had this suspicious that i'd run across "something" that i just couldn't do well and the whole thing would fall apart somehow

thedavidmeister15:01:01

obviously every day that goes by without everything falling apart makes that less of an issue

thedavidmeister15:01:36

but i dunno how you tackle that with docs in a world of hundreds of shiny frameworks making big claims about solving all your problems for you 😕

micha15:01:50

it's very tricky trying to find the minimum viable framework

micha16:01:27

you don't want to end up painting yourself into a corner and end up with a ton of work invested in something that has a fatal flaw that was hidden

micha16:01:01

that's one reason why we went with jquery as the bottom layer

thedavidmeister16:01:18

even more than that, i want to be able to use some of that ton of work as a launchpad for the next project too!

micha16:01:25

at least then you can get out of a fix with some jquery plugin if you need to

micha16:01:06

but i think we're slowly converging on a better thing

micha16:01:11

don't need jquery anymore

thedavidmeister16:01:20

yeah, i'm personally not that bothered by having jquery there, but i know not everyone is ok with that

micha16:01:49

yeah the only issue i have with it is that we get tied to its api too tightly

micha16:01:06

like when jquery makes breaking changes we have to make breaking changes sometimes

thedavidmeister16:01:16

that's totally fair

micha16:01:19

and that is bad for the library ecosystem

thedavidmeister16:01:28

but then browsers will just adopt the jquery api anyway

thedavidmeister16:01:11

i suppose in some areas its much easier to avoid jquery than others

thedavidmeister16:01:58

also hoplon doesn't even touch on all the things that jquery is for

micha16:01:15

yeah just the dom standardization

micha16:01:31

which is less and less important probably as time goes on with evergreen browsers

thedavidmeister16:01:54

actually, i did a review of someone's first hoplon attempt, who is used to doing things "the jquery way"

thedavidmeister16:01:04

and they made a lot of the same mistakes as i did

thedavidmeister16:01:33

trying to traverse the dom or doing weird things with events

micha16:01:16

yeah you have to think kind of backwards sometimes

micha16:01:35

similar to the switch to functional programming from imperative i think

thedavidmeister16:01:57

actually i didn't find that as hard as everyone makes out tbh 😛

thedavidmeister16:01:10

maybe because people make such a big deal about it

micha16:01:14

i remember having a hard time with lazy sequences

micha16:01:23

i just used mapv everywhere for a while

thedavidmeister16:01:55

yeah but, whatever, think about how hard it was the first time you learned all the different ways to do things in OO

micha16:01:07

yeah c++ was crazy times

micha16:01:29

the friend members, and template programming

micha16:01:55

really not into it

thedavidmeister16:01:23

also, there always seems to be that one guy who loves making really complicated classes

micha16:01:57

not just one guy

thedavidmeister16:01:57

so i was expecting something like, 10x harder than all that, at least

micha16:01:05

if it was just one guy we could kill him

thedavidmeister16:01:39

to justify all the resistance

thedavidmeister16:01:50

so yeah, didn't really live up to my expectations

thedavidmeister16:01:21

maybe you could do some "migration" docs :thinking_face:

thedavidmeister16:01:02

but it's more like, responding to the things ppl say here in chat from different backgrounds

thedavidmeister16:01:13

jquery, react, other cljs approaches, etc.

micha16:01:25

i have been looking at http://readme.io lately

micha16:01:32

for documenting things at work

micha16:01:47

it has a really nice interface for editing

micha16:01:52

and it forces you to be organized

thedavidmeister16:01:06

oooh, not that cheap though

micha16:01:08

not like a wiki where you can have old pages that are just hanging around

micha16:01:32

i like how it lets you make a real hierarchical structure

micha16:01:42

vs a web that you make in a wiki

micha16:01:58

docs really need to be like a book i think

micha16:01:09

so you can easily manage keeping it up to date and so on

micha16:01:17

with chapters and sections and all that

micha16:01:31

and a freakin table of contents lol

thedavidmeister16:01:35

and yeah, my experiences with wikis is that out of date, broken info always gets left lying around in nooks and crannys

micha16:01:45

it would be cool maybe to have an electron app that gives the http://readme.io interface

micha16:01:54

but edits files in a git repo

micha16:01:01

maybe a github wiki even

micha16:01:08

but generating the table of contents and all that

micha16:01:16

keeping everything well organized

thedavidmeister16:01:58

it would be super easy to make little electron apps that stitch apis like that together

micha16:01:02

i guess a program that takes markdown files organized as a book and compiles them into a github wiki

micha16:01:16

would be the first step

thedavidmeister16:01:17

it's defs on my list of thing to try out

thedavidmeister16:01:21

curious to see how you go

thedavidmeister16:01:13

@micha i've used this before, for just getting a heirarchy of markdown up on something like github pages http://www.mkdocs.org

micha16:01:00

i thnk i would want something that enforces no orphaned pages

micha16:01:12

could be built on top of that it looks like

thedavidmeister16:01:32

also, there's like a million static site generators out there

micha16:01:35

like everything must be in the table of contents if it exists

micha16:01:51

yeah true

thedavidmeister16:01:10

if your main requirements are markdown + automatic TOC

thedavidmeister16:01:16

i reckon you can avoid the monthly fee

micha16:01:33

yeah also edit-in-place would be nice

micha16:01:37

but not required really

micha16:01:53

like http://readme.io you can edit in the page, which is kind of nice sometimes

thedavidmeister16:01:42

on the flipside, when i'm doing commercial things i tend to ask ppl to PR docs with technical info in them

thedavidmeister16:01:31

i did see that cljsjs has something ready to go for this https://yabwe.github.io/medium-editor/

thedavidmeister16:01:12

it's like 3:30am here

micha16:01:23

haha see you later!