Fork me on GitHub
#off-topic
<
2017-05-08
>
dominicm07:05:16

Never thought of that... What's a web browser like vertically? When I see people with vertical screens, it seems odd.

qqq07:05:41

dunno; I tend to use web browser only to (1) browse docs and (2) test cljs dev

pesterhazy09:05:44

Has anyone found a way on macOS Sierra to remap CapsLock to Control (when used as a modifier key) and to Escape (when pressed quickly)?

pesterhazy09:05:59

It used to work with Karabiner on earlier versions of macOS

pesterhazy09:05:19

https://www.keyboardmaestro.com/main/ seems to support it but it's 40 EUR !

qqq09:05:31

so if you press capslock and lets go without hitting another key,

qqq09:05:34

then register escape ?

pesterhazy09:05:49

@gmercer that's a good first step, but it gives me either control or escape, not both (which is the holy grail)

gmercer10:05:27

that yak needs a shave, right?

pesterhazy10:05:02

macOS sometimes feels like the Windows of the 90s, with all kind of shareware needed to be productive

gmercer10:05:13

from previous ... The text system supports the specification of multiple keystroke bindings through nested binding dictionaries. For instance, Escape could be bound to cancel: or it could be bound to a whole dictionary which would then contain bindings for the next keystroke after Escape.

gmercer10:05:30

it really seems Karabiner is just hooking into that system

pesterhazy10:05:42

I'm now using Keyboard Maestro, which does work (but boy is it pricey)

flaviohenriquecbc17:05:06

Hey, guys!! I have just written another article about Javascript. Let me know what you think ๐Ÿ˜‰ https://medium.com/@flaviohfreitas/javascript-save-time-by-avoiding-re-writing-these-common-functions-266835c0bf68

qqq17:05:14

@pesterhazy : think this can be solved in 30 lines of swift

qqq17:05:20

you should write it and undercut all your competitors

qqq17:05:29

I think it's actually something everyone who uses vim would actually want

qqq17:05:05

"apple took away your esc key? this program restores it via capslock"

fellshard17:05:27

Pretty sure they did that solely to spite / prevent Windows installations on their hardware

qqq17:05:42

I haven't used Windows in ages. Why does Windows need ESC key?

fellshard17:05:38

I don't think windows itself uses it so much

fellshard17:05:57

Ctrl-Shift-Esc comes to mind - that's the combo for bringing up the task manager directly

fellshard17:05:16

But a lot of applications use the Esc key to implement functions equivalent to 'cancel'

fellshard17:05:27

Backing out of menus, etc.

qqq17:05:30

If they relly want to piss off Windows, they sholuld (1) only have backspace, no delete or (2) only one of ctrl/alt

qqq17:05:57

I have a TV, which when mounted horixontally, uses 400mmx 200mm. Suppose I mount it vertically at 200mmx400mm, would there be problems? (My main concern is that the VESA mount on the TV is intended to only carry weight in one direction; and now I'm applying force in a perpendicular direction

akiroz17:05:09

Sales pitch: USB Esc key the size of a thumbdrive

akiroz17:05:43

maybe it's already on kickstarter somewhere >.>

roberto17:05:08

re-map the power button to ESC ๐Ÿ™‚

akiroz17:05:36

TBH, the lack of F keys on a macbook is already pretty rage-inducing for your average Windows user ๐Ÿ˜›

fellshard18:05:33

Muh IntelliJ

ballpointcarrot18:05:27

USB Esc key seems like itโ€™d be a thinkgeek april fools product

noisesmith18:05:19

so does a laptop for programmers that lacks an esc key

fellshard18:05:38

This is why our company suddenly backed down from moving onto MacBooks as our standard dev laptop

mobileink19:05:58

i use ?-[ but i can't remember what ? is away from my keyboard, maybe ctrl. works everywhere.

noisesmith19:05:52

too bad itโ€™s so hard to hit one handed though

mobileink19:05:13

fortunately i have 2 hands :). found it, ^[ = ESC. invaluable if you have to switch from mac/window/linux frequently.

qqq20:05:34

I can't recall the last time I used the F keys.

akiroz20:05:44

the only time I use F keys is when switching virtual consoles in linux but most of the Windows users I know perfer them over chorded keys

akiroz20:05:20

like F5 instead of Ctrl/Cmd+R

akiroz20:05:19

now that I look at the standard PC keyboard again, it's actually pretty hard to press Ctrl+R...... I remapped my Ctrl key to whatever next to the spacebar.

mobileink20:05:23

volume control when i'm watching Better Call Saul.

qqq21:05:29

apple = genius; removing f keys = more productive employees

qqq21:05:39

@mobileink : btw, I'm still waitingon that polymer library of yours

mobileink21:05:24

it's killing me!

mobileink21:05:59

i'll be uploading revisions today but that code will give you some idea. docs are outdated .

mobileink21:05:53

one thing that is done is the sugar: :#foo = id="foo", #.bar => class="bar", #!baz => boolean attrib. so:

(h/span :#foo.bar.baz!centered "hello")
=>
<span id="foo" class="bar baz" centered>hello</span>
. not earth shattering but kinda nice imho.

mobileink21:05:09

also:

(h/span :#foo {:miraj.style/color "red" :miraj.syle/hover {:color "green"}} "hello")
does the right thing.

mobileink21:05:30

=>

<span style="color:red;">hello</span><style>#foo:hover {color:green;}</style>

john22:05:00

dyad looks too unfamiliar

john22:05:22

it's short though

mobileink22:05:24

so it's not really an atom, but it's related or similar in some way. to what extent need the name reflect the semantics?

mobileink22:05:36

fwiw, i'm only half unserious - i spend waaay too much time thinking about names. but in the end i think it's worth it.

john22:05:52

Regarding @hiredman's point about stale reads... Isn't it the case that threads in Clojure can also have stale content? Due to persistent structures? But because the structures are persistent, it's okay because we're working with a stable version of the value? And if we want to commit a new value, it won't commit unless the working value lines up with the latest value, right?

john22:05:26

I'm trying to nail down the exact divergence in semantics here

mobileink22:05:40

boy, you got me there, not sure.

mobileink22:05:33

define "stale"

hiredman22:05:45

no, you can't get stale reads with an atom, once you have swapped in a value(or even reset! a value), all derefs after that (determining what after means here can be problematic) will read that

mobileink22:05:36

tbh i'm not sure what it would mean for a thread to "have content".

john22:05:59

@hiredman But, to clarify, when I say a "subscriber swaps," that subscriber sends the function to do the swapping to the owner.

john22:05:29

and the owner executes the swap in a synchronous context there

hiredman22:05:38

yeah, that is the wrong way to do that

mobileink22:05:00

to me, threads do not have content, any more than a cpu has content.

john22:05:01

(and it sends the old-val, to do the compare and swap)

hiredman22:05:19

you don't need to send both the old value and the function

hiredman22:05:25

one or the other

hiredman22:05:59

if you send the function, js is single threaded, need to really even do a compare, just apply the function producing the new value and move on

hiredman22:05:52

if you actually want to do the cas, the thing to do is read the old value, apply the function to it, then send cas old-value new-value to whatever owns the reference, then get a succeeded/failed value back, and try again if it failed

john22:05:02

what if the subscribing context wants to update the atom, conditionally, based on the current value? If they issue the fn with an incorrect assumption of the current value...

mobileink22:05:13

a thread can be used for different bits of code.

john22:05:36

@hiredman That's what I'm doing. The swap function is just built on top of that process.

mobileink22:05:40

see clojurescript's block v. park.

john22:05:48

@mobileink yeah, but in js, workers def have their own bits and bytes. You can't view others' values without passing messages.

hiredman22:05:51

@mobileink core.async's go blocks are not interleaved and are cooperative, so unless you actually do an async operation some other "thread" isn't going to run in the middle of whatever you are doing

john22:05:10

@hiredman oh, that's not exactly what I'm doing... why do you want to have the execution local, and then update the remote context?

hiredman22:05:33

only if the remote context is hasn't changed

john22:05:36

well, you'll never have a true "hasn't changed" status, in a truly atomic way.

john22:05:46

By the time you submit, it might have changed

hiredman22:05:09

be the time you send the message it may have changed, which is why the cas message includes old and new values

hiredman22:05:30

so the "owner" gets the cas message, can determine if the cas is valid to run or not

hiredman22:05:46

if it is not valid it replies "not valid" and the send of the cas has to re-read and try again

john22:05:49

But why? the point is to offload the execution to the "thread"

mobileink22:05:53

doesn't cooperative imply interleaved? sorry to be dense, i'm thinking coroutines. not much point to it if no interleaving (by which i mean sth like dispatching to other "threads").

hiredman22:05:11

cooperative implies no preemption

mobileink22:05:11

right but that is not inconsistemt with interleaving (depending on how you understand the latter).

hiredman22:05:23

coroutines are cooperative in the sense that another coroutine won't just randomly run in the middle of the coroutine that is currently running

hiredman22:05:44

cooperative implies interleaving happens at the discretion of the executing code

mobileink22:05:55

yes, but the controller decides what runs next.

hiredman22:05:55

which is not the case with "real" threads

hiredman22:05:34

if I write a go block with a hot loop that never calls any of the parking ops, on clojurescript, nothing else will ever run

hiredman22:05:17

there will be the single js thread, executing my hot loop, and core.async doesn't "yield" to other "threads" unless you do async ops

hiredman22:05:21

cooperative

mobileink22:05:30

that's what i understand by "interleaving" - it does not imply preemptive scheduling.

hiredman22:05:04

but interleaving won't happen unless you let it, so if you have a section of code that is adverse to interleaving, don't let it

john22:05:25

workers can't block and park though

hiredman22:05:18

sure they can, you have that shared communication channel that passes messages with the ui thread

hiredman22:05:37

you "park" by hanging a callback on that and then don't do anything else

hiredman22:05:18

really you have two things here

john22:05:21

So, I do plan on implementing a callback queue... what do you mean by "park" in this context though?

mobileink22:05:28

@hiredman exactly. i guess my point is there are 2 kinds of interleaving, preempitive and not. concurrency is consistent with single thread if you have coroutines, no?

hiredman22:05:30

1. some way to do work on another thread

hiredman22:05:40

2. some way to communicate the results of that work

hiredman22:05:53

you are sticking those two things together as some kind of reference type

qqq22:05:56

@mobileink : so to see the demos, I have to check out the rep oand open it locally?

qqq22:05:06

I wonder if there's some way where these demos can be hosted, online, as a webpage or something

qqq22:05:12

and then, from github, linking to said demo

qqq22:05:14

๐Ÿ™‚

mobileink22:05:29

to clarify : there are also 2 notion of thread here. one is the machine, the other is program text.

hiredman22:05:37

I suggest some kind of launch worker function and then a nice core.async api on top of however you pass messages back and forth

hiredman22:05:52

and no reference thing

hiredman22:05:36

or a reference thing and work queue thing

john22:05:59

I'm thinking about supporting returning chans on mutation operations, as an extra feature.

mobileink22:05:50

@qqq: like i said it's killing me. the goal is to get templates in place so you can easily start futzing with it, or you can fork/clone demos and play. i gave the ref just so you can inspect the code until i get that done. Real Soon Now. Rilly!

mobileink22:05:48

@qqq plus i expect to host some of the demos on gae.

john22:05:41

@hiredman do atoms have queues? How does Clojure repeatedly swap on an atom, say, with inc, without each swap waiting for the new value of the atom?

hiredman22:05:55

it is an atomic reference

hiredman22:05:02

compare and set

john22:05:40

ah, and all the swaps are synchronously executed on a particular thread, so they aren't competing.

hiredman22:05:55

they can be competing

hiredman22:05:00

clojure is multithreaded

john22:05:03

but if we did repeatedly (future (swap then those swaps would be competing

hiredman22:05:15

sure, and they can compete

hiredman22:05:42

err wrong l ink

john22:05:00

So, since all of my mutation operations occur asynchronously, every call to swap immediately populates the calling function with the old-val

john22:05:13

so I need a queue to wait on the new-val

john22:05:56

which is what I did with my agent proof of concept. Wasn't sure if i'd need it for the atom-like thing

mobileink22:05:36

since we're talking about program text, you could also borrow a term from https://en.m.wikipedia.org/wiki/List_of_sewing_stitches

hiredman22:05:38

I would suggest you read up on compare-and-swap, if you don't understand what it does (the fencing behavior, beyond just writing new contents to memory) then it is very unlikely you will implement it correctly

john22:05:52

@hiredman I have been researching CAS and I plan to dig in more. Thanks for all the advice. I really appreciate it.