armantorkzaban
@armantorkzaban
I'm already there. I thought I'd enter a discussion being held. But it is quiet.
Oo Kang Zheng
@ookangzheng
dinesh
@1532j0004kg
so what is difference between https://codepen.io/anon/pen/xjJZGN?editors=0010 and async/await function
armantorkzaban
@armantorkzaban
https://www.redblobgames.com/pathfinding/a-star/introduction.html very neat introduction to A* algorithms plus implementation guide.
dinesh
@1532j0004kg
A* algorithm means ? @armantorkzaban
armantorkzaban
@armantorkzaban
Nina Breznik
@ninabreznik
Great job @TzuYuanLiu . Just watching it right now.
For the next time we can then really plan Building DApps with Solidity in Remix :)
Alexander Praetorius
@serapath
@TzuYuanLiu the callback style programming is indifferent to whether the code is running sync or async, because it does not rely on the order top to bottom following line numbers anymore, while traditional sync programming relies on this order ... so if you use callbacks, it doesn't matter if there is a setTimeout or $.get(...) or anything else that makes things async for real is involved or not
Alexander Praetorius
@serapath

@1532j0004kg your code does not return the expected output "resolved"

You can write it in 2 ways - either callback style or async await style

// define - callback style
function resolveAfter2SecondsCallback (next) {
  console.log("hi callback")
  setTimeout(() => next('result callback'), 2000)
}
// use - callback style
console.log("calling callback")
resolveAfter2SecondsCallback(next) // => "result callback"
function next (result) { console.log(result) }
// -------------------------------------

// define - async await style
async function resolveAfter2SecondsAsync () {
  console.log("hi async await")
  return new Promise(next => setTimeout(next, 2000, 'result async await'))
}

// use - async await style
console.log("calling async await")
var result = await resolveAfter2SecondsAsync()
console.log(result) // => "result async await"
Nina Breznik
@ninabreznik
For all of you interested in learning Dat. @ookangzheng maybe you could make a little demo to explain how this app was built https://blog.datproject.org/2018/05/14/dat-shopping-list/
Alexander Praetorius
@serapath

@TzuYuanLiu @ookangzheng

  1. in case of async await, you have to learn

    • new Promise(resolve, reject) and async function fn ... and var x= await fn() and maybe .then and .catch and so on... all code will look like it and it only works in langauges that support it
    • also translating the logic of promises and await and async to assembly code seems to require quite a bit of stuff - so i assume it to be more resource intensive in terms of memory or cpu
  2. in case of callbacks, you have to learn

    • function ...oh right, you already know that. The only thing that is necessary is to be able to pass functions (whether you perceive them as pointers to code or values) to other functions as arguments for params
    • basically most languages out there will allow you to pass functions to other functions as arguments (even if passing is sometimes only possible method of an object)
    • ...which means it's a more general approach. Even in low level languages like C you can pass pointers and that's all you need so the abstraction is really low and thus fast and less resource intensive

In a long career as programmers ...that will last probably many decades - i assume it's a good thing to learn callbacks - and once you know them - it seem promises/async/await are redundant.


If you check the amount of code necessary of the code above - you might see, that defining and using callbacks takes maybe less but otherwise at least similar amounts of code.
It's not more verbose.

@ookangzheng do you maybe have examples of "composition" to play with how to recreate some promise or async await examples in callbacks - just for the sake of comparing how they are similar or different?

@TzuYuanLiu @/all when would be the best date for everyone to do the solidity workshop? :-)
Oo Kang Zheng
@ookangzheng
I prefer on June :smile:
Alexander Praetorius
@serapath
ok, then june :-)
TzuYuan
@TzuYuanLiu
I was thinking about May the 28th...and it's almost June haha. Not sure how long would it take: we could arrange it on every Monday for 2~3 weeks if it's gonna take that time :D
Alexander Praetorius
@serapath
oh, i think we fly back to UK on that day
TzuYuan
@TzuYuanLiu
Oh! How about May 4th? :)
Nina Breznik
@ninabreznik
June 4th, you mean? I have a doctor checkup on that day. I think it's around 3pm UK time, but not sure.
TzuYuan
@TzuYuanLiu
U.K. Time is GMT+1 so it's 7hours late from us. Is it ok to start from 1pm (GTM+1)?
Ohh yes I meant to say June 4th haha
Alexander Praetorius
@serapath
i'm cool with june 4th
Alexander Praetorius
@serapath
But it would be nice to do it together, so maybe the next possible day after June 4th? :-)
TzuYuan
@TzuYuanLiu
I just read through the explanations about your points of callbacks. Thank you Alex, that makes sense. Callbacks and codes not running in order -- stuffs like that are getting clear in my mind.
Now I just need to write more comparisons of side by side codes of different fashion.
Sure sure. How about June 11th? :D
Nina Breznik
@ninabreznik
That sounds better, then we know we definitelly have enough time @TzuYuanLiu
TzuYuan
@TzuYuanLiu
@all @ninabreznik Lovely! Let's set it on 1pm (GMT+1) June 11th!!
dinesh
@1532j0004kg
@TzuYuanLiu hi
TzuYuan
@TzuYuanLiu
@1532j0004kg Hi :D
dinesh
@1532j0004kg
On succcess redirection in passport ... How to set the redirection to username ( Ex: http://localhost:8080/user/1234 , If the entered username is 1234)
Nina Breznik
@ninabreznik
Excellent, @TzuYuanLiu. Is GMT+1 London time? hihi

Let's announce it like a week before again on FB and here and Twitter and then 3 days before and on the day. That way we remind people to not forget.

PS: I would recommend this for each event, not just ours...

Nina Breznik
@ninabreznik
@1532j0004kg Where are you getting this error?
Oo Kang Zheng
@ookangzheng
:clap:
TzuYuan
@TzuYuanLiu
@ninabreznik yes!
London, the capital of the United Kingdom, is on Greenwich Mean Time (GMT) only during winter months. The GMT timezone has the same hour offset (GMT+0) as the Western European Time Zone . When Daylight Saving Time starts, London and the whole of UK are on British Summer Time (BST), which is GMT+1.
I am thinking of that too! So that ppl will be aware of the event.
Oo Kang Zheng
@ookangzheng
We now start a live streaming: https://meet.jit.si/wizardamigos
Topic: PWA Introduction
TzuYuan
@TzuYuanLiu
Thanks for Matt's sharing!!
Alexander Praetorius
@serapath
oh nooooo, i missed that one. just saw the repo. looks super minimal and cool. is the video recorded? :-)
Nina Breznik
@ninabreznik
@serapath Which repo?
TzuYuan
@TzuYuanLiu
TzuYuan
@TzuYuanLiu
I think we failed to record last night
TzuYuan
@TzuYuanLiu
_<
Oo Kang Zheng
@ookangzheng
i will upload later the video 😂
a little busy
TzuYuan
@TzuYuanLiu
oh really!? We did record it!?
Yay! Awesome!
Nina Breznik
@ninabreznik
Andrés Correa Casablanca
@castarco
Hi
is anyone going to the today's meetup?