« first day (3265 days earlier)      last day (1905 days later) » 

18:18
Gif chatroom link please
Sorry I was helping someone with some code
@Mr_Green wat?
@KendallFrey ummm I'm not sure I follow, in this instance key is not the actual key of the hashmap, but the propertyname of the property to act as the key in the array of objects
Hey, there used to be a chatroom with full of gifs
I can't find it now
18:21
Oh yeah the bandwidth became too much
They were acquired by 9gag
ohh that room
I can't go into that anymore
kills the onebox script
oh what was the name?
I tried gif but with no luck
@Vap0r 9gag is addictive. don't want to visit now. willing to sleep in 15 mins or so
@Vap0r Right, that makes maps with the same type of key incompatible if the key property is different
I still am not following.
They propertyname will be a string

Orphan GIFs

A place to put illegitimate and unwanted GIFs
18:24
the key that the propertyname refers to can be any type
yes, but ideally you want compatibility between maps with the same key type, not the same key property
putting the key property in the type itself defeats that
Only here b/c Android room requires approval 1st
i wonder why
@rlemon ah at last. Thanks! :D
Might anyone be able to discuss the functionality shown here at exactly 5:40?
I want to replicate the motorcycle outline shown in screen shot at 5:40
without creating an app
sorta
18:33
not a live tracing of the bike
pretty sure that outline is a static outline
Correct
Ive looked at all this
so just take a camera video, and overlay the outline
photoshop
'https://www.google.com/search?sxsrf=ACYBGNTbtYfRpSyUK7aBu4pdGFNKGwrhYQ:1569317001994&q=Overlay+image+on+camera+Preview+site:stackoverflow.com&spell=1&sa=X&ved=0ahUKEwjhi8azkenkAhUDm-AKHaZ4CbwQBQgvKAA&biw=1161&bih=553
Yea, PS but how to implement it code wise
is very tricky as ive seen here
I mean it's not at all
18:34
Ooops Link posted
already
context.drawImage(video, 0, 0);
context.drawImage(overlay, 0, 0);
essentially all that is required
Yep and Im lost
learn Canvas API
if you want it to be part of the actual image
I dont want it to be a downloadable app
I want it to just work for anyone listing a bike on my site
yes, learn Canvas API, get the users camera, draw the video to the canvas, then draw the overlay to the canvas.
18:36
for left, right, front, rear etc as shown in video
Canvas API, Good clue
but I think it may be barking up the wrg tree
Id like to make these outlines in photoshop
you can
its just how do I code it into the site?
2 mins ago, by rlemon
context.drawImage(video, 0, 0);
context.drawImage(overlay, 0, 0);
overlay is the image resource for the overlay
draw it in PS if you want
Ive seen that (roughly) but it makes my eyes roll back b/c its not PHP or JS etc
java or some shit
it is JS
it's 100% JS
18:38
Ohhh
Bingo
Im back on track and gonna have to re research google.com/…
Thanks @rlemon
I want to and plan on adding this outline functionality to my classifieds here your-adrenaline-fix.com/classifieds/add.php so that when someone adds a listing, along with some JS Ill be able to do the same w/o my visitor having to download anything
JS to carry them from Left photo, to Right, to Front etc
similarly to as shown
Thx again for the killer clue telling me it IS JS @rlemon
makes it much more achievable by 2020
and the JS that should carry me thru for pic iteration
Thx again, Ill be in touch
why
1/4 of the way down
you don't want a native app
I think is what scared me away
<com.uax.cameratakephoto.CameraPreview
    android:id="@+id/camera_preview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_centerInParent="true" />
What is that Shit?
that's android
18:50
Java?
you're on an android question
Seems to be the only method Ive seen of doing this
getUserMedia -> https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia a way to get the users media in the browser
canvas api -> https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
idk if you can ever get the rear facing camera
Theres nothing Ive seen in that Google search that doesnt have that
I assume you can
18:51
ie
<com.uax.cameratakephoto.CameraPreview
android:id="@+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true" />.0
because you're searching for android specific stuff
which is fine, if you wanna write an android app
Search Q "Overlay image on camera Preview site:stackoverflow.com"
Ill keep looking
I am looking for a good JS book to brush up on my concepts and understanding. Any suggestions? Its for my interview preparation
and thx for the addtl links
18:57
Rob, How much $$ to code up that functionality?
$100?
Ill make the photos
your funny
I like learning and its all stuff ive already learned, Im just for once going with the adage of "sub some things out to use your time better elsewhere" or something like that...
@KevinB Dont worry, This would be ontop of currently existing photo UL functionality already on my site
just adding in the overlay
and JS for stepping thru
$100 pls
I hear ya
const opts = { audio: true, video: { width: 640, height: 480 } };
const video = document.querySelector("video");
const canvas = document.querySelector("canvas");
const context = canvas.getContext("2d");
const overlay = new Image();
overlay.crossOrigin = "anonymous";
overlay.onload = main();
overlay.src = "https://i.imgur.com/Y0nauDw.png";
async function main() {
  const stream = await navigator.mediaDevices.getUserMedia(opts);
  video.srcObject = stream;
  video.onloadedmetadata = () => {
    canvas.height = video.videoHeight;
19:01
Didnt know if it looked like something u could turn out in an hr
That man looks like the fellow who sells newspaper in the morning
ignore the fill rect stuff
forgot to delete that
Dont currently have a clue how or what to do with that
all that does is take your webcam stream, put it on a canvas. then draw this picture over top of it
which is all you need to do
but with a picture of a bike
OMG, I saw the glasses in the pic, It just didnt register tilll now
I didnt know why you posted that... lol
until now
Its all coming into focus just not the code
yet
19:04
well read the code. hit up the pages I linked
it should explain most of it
Im Going TO
for a mobile, you'll have to change the opts constraints object
Hey. Can I get some help with figuring out why my async code is blocking (I am running some I/O operations and DOM rendering with electron and I am getting the beachball)? I was working with forest on this before.
bookmarked each as weve gone
Thank You Very Much Rob
I decided to play with three a bit
made a stl viewer
"made" being generous
19:07
I will be carefully perusing all this
this has no impact on your stuff
I just wanted to brag
I have two issues
Dude....
Many, Many Thanks
But that operation is async so I don't see why its blocking
do you have more than one handle touching sqlite?
sqlite loves to block
19:08
Yes, new Conversation access the db twice
if you need multiple processes touching the db, don't use sqlite
Not sure what im looking at here rlemon.ca/3d
@rlemon I can't choose the DB type. The DB type is already chosen, it is a viewer.
> SQLite allows multiple processes to have the database file open at once, and for multiple processes to read the database at once. When any process wants to write, it must lock the entire database file for the duration of its update. But that normally only takes a few milliseconds.
but it does open another question:
19:10
it's like Mongo in this regard
@rlemon There is no writing.
regarding the 3D effect but Ill come back to that another day
         const promises = [];
         promises.push(chats.map(async chat => {
            const convo = new Conversation(chat, db);
            promises.push(new Promise(resolve => {
                convo.on("ready", resolve);
            }));
            convos.push(convo);
        }));
        return Promise.all(promises);
this is all sorts of messy
Yeah, thats was like my 5th attempt at making it work.
  const promises = [];
         chats.map(chat => {
            const convo = new Conversation(chat, db);
            promises.push(new Promise(resolve => {
                convo.on("ready", resolve);
            }));
            return convo;
        }));
        return Promise.all(promises);
Should be more like that ^
the fuck are you pushing in a map with no return?
that defeats the purpose of a map
19:12
lol
there we go
that return is meaningless still
that didn't fix anything :D
one sec
const promises = [];
            const convos = chats.map(chat => {
                const convo = new Conversation(chat,db);
                promises.push(new Promise(resolve => {
                    convo.on("ready", resolve);
                }));
                return convo;
            });
             Promise.all(promises).then(_ => {
                 mainWindow.chats = convos;
                 mainWindow.loadFile(path.join(__dirname, 'src', 'render','index.html'));
             });
How about that
if not, please suggest how to fix
The second async blocking issue is here → github.com/jbis9051/messages-viewer/blob/master/src/render/…
considering the rest of the code, I don't think any of this will work the way you want
addConvo is async but seems to create issues
19:19
const arr = [];
someAsyncAction().then( .. populate arr );
// never uses arr
do you ever intend on using it?
if so, putting it in the outer scope like that and then populating it async isn't going to end well
so how do you suggest I do it?
and if you don't intend on using it. just ignore it
I use it later
 let db;
[...]
 const convo = new Conversation(chat, db);
I tried to chain it as forrest suggested chat.stackoverflow.com/transcript/message/47383609#47383609
I guess I'm still trying to figure out how you'll use it
because you call createWindow() or w/e the electron thing is
and then the window is created.
but async actions are still being queued in the background
you have no clue when those will finish
the idea is the following:
Load a loading page, start some async operation, when its done load the main page and pass the result of the async operation to the main page
19:23
sounds more like you want observables
why? I want to start the async operation immediately
(either way, it shouldn't be blocking)
and you want to do something only when you have a variable containing the changed results.
well idk why that's blocking. it doesn't look like it'll work in the end tho
because async nature
it works fine, it just takes forever and is blocking (it seems)
well then you never use convos ever in the future
in which case storing them is pointless
@rlemon isn't that most promises. If you fetch a page you want a variable with the result.
@rlemon I do. line 47.
19:27
that's still in the promise chain. you don't need to store that outside of it
so then how do you suggest I do it?
don't chain the then statements?
no don't nest them
so whats the alt. If I shouldn't have a global scoped variable than I dont see a way to do it without nesting.
fyi, this is the Conversation constructor
constructor(chat, db) {
        super();
        this.chat = chat;
        this.db = db;
        Promise.all([
            this.getParticipants().then(participants => this.participants = participants),
            this.getMessages().then(messages => this.messages = messages),
        ]).then(_ => this.emit("ready"));
        this.start = null;
        this.end = null;
    }
o/ forrest
mornin
not sure if it answers your question but you can pass data down the promise chain by returning it in the .then
still working on the issue from before
19:37
I'm not following rlemon's reasoning for using observables here
I don't see this as an event stream
it's a one-time async operation
.then( chats => {
    const convos = chats.map( chat => new Conversation( chat, db ) );
    Promise.all( convos.map( convo => once(convo, 'ready') ) );
    return convos;
})
mixing streams and promises is usually pretty ugly.
agreed, don't mix them
er, await that Promise.all
19:38
but I'm not seeing any event stream here
Convos is an ee
he waits for ready
then collects those up and waits for them all
ahhh
I see what you mean
.then( async chats => {
    const convos = chats.map( chat => new Conversation( chat, db ) );
    await Promise.all( convos.map( convo => once(convo, 'ready') ) );
    return convos;
})
super ugly.
but should do what you had at least
doesn't need to look like that
How do you suggest designing it to make it non super ugly?
19:39
and once is from EventEmitter module
just return the Promise.all array
he needs convos
which is an array of EEs
that .map is being thrown out
should that be a forEach
OH
not in my code
my bad I see it
you're waiting for the operations to finish, I get it
what's once
@rlemon This could be my partial understanding of async and the event loop, but what if while the map is running through, one of the convos emit's the 'ready' event, it won't be caught so the promise.all will never resolve.
so you take all the chats, wrap them in the convo EE, then loop all of those and wrap them in a once promise for the ready event
await that hooplah
then return the convos
@JBis I highly doubt you'll run into any race conditions on this
I'm pretty sure the event loop is smart enough about finishing the block
but you could probably test that
-1
Q: Code which was working fine, has stopped adding values to local storage

Billy GI have created a script which every time i click a button "Dark mode" it changes the background colors of the html elements it saves them in local storage, so every time the users browsing the different pages of the website they see the same colors. The code was working fine but i checked it agai...

@rlemon Ok. But you still say your code is ugly, how can it be improved?
19:44
not mixing streams and promises
And how would I do it without event emitters
it leads to pointless conversions
wdym by "streams"?
convo is emitting a stream of events, it's not just resolve-and-done
that's why he's using the once function in particular, he's throwing out the rest of the stream
I only emit one event. How is that a stream?
19:47
It's a stream with one event. It's a stream because it's designed to be able to emit multiple. That's what emitters are for.. more or less
Ok fine. But how do I avoid using it? I can't (and shouldn't be able to) return a promise from the constructor so how do I tell when the conversation is "ready"
that's why I suggested to use observables
and a store
do the action there. set the data when 'ready'
I think you can make it work with promises
hmmmm
        const convos = chats.map(chat => {
            const convo = new Conversation(chat, db);
            promises.push(new Promise(resolve => {
                convo.on("ready", resolve);
            }));
            convos.push(convo);
        });
this doesn't make any sense to me
why are you pushing to convos from within the map fn
also. emit is sync. not sure if that's your blocking issue
> Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.
so if you have 1000s of convos, that'll block for sure
hundreds, but yes
@forresthopkinsa ignore that, it wasn't used
const convos = chats.map(chat => {
            const convo = new Conversation(chat, db);
            promises.push(new Promise(resolve => {
                convo.on("ready", resolve);
            }));
            return convo;
        });
19:53
so hundreds of convos spins up hundreds of blocking emits, but also hundreds x3 db calls.
nice
Yep.
you're doing way too much IO
I'd work on trying to reduce that
Here's what I'm doing: Each convo has associated people and associated messages. First we get the convos (db), then create a new Conversation which gets the people (db) and messages (db).
How do I reduce I/O?
idk, restructure 😛
I'm not invested in the app. so I'm not thinking about it much
but you're having blocking (or delay) issues around that operation
I am fine to restructure but idk how.
19:58
I'm looking to understand Docker behavior a little more -- any users in here?
I don't see the 3 db reads as an issue.
@duhaime what is dock
Docker is an application for making containers
@forresthopkinsa where you put your boats so they don't float away
;)

« first day (3265 days earlier)      last day (1905 days later) »