-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are there answers for the exercises #21
Comments
Hey @stuartambient, thanks a lot for opening this issue. As of today, we don't have yet a place to collect solutions for the various coding tests. I think GitHub might be a great place to start collecting some. I just created this wiki page to do that: https://github.com/PacktPublishing/Node.js-Design-Patterns-Third-Edition/wiki/Node.js-Design-Patterns-Third-Edition---Exercise-Solutions Have you already implemented any solution for these exercises? 😉 |
Thanks for putting that page up, I'm subscribed and will certainly share my solutions. I just finished reading Chapter 3 and did 3.1 (a minor tweak of a challenge) but 3.2 confused me a bit regarding the number that gets sent to the function. I couldn't tell if it was a number in milliseconds or the number of times setTimeout should run. Typically I prefer to do a challenge first and then look over others solutions afterward (if they are available). Thanks for the response and creating what is in my opinion an invaluable and comprehensive Node book. |
Is this the right solution for 3.1? Or should we clean up the event listener after the start event is emitted in case someone uses .on for this event instead of .once and the file that is processed is so enormous that it takes doesnt make sense to just wait till the instance gets garbage collected. |
I just added a line to the for loop in add()
Probably would be a good idea for me to add a remove listener at the end. |
@enricoschaaf that looks like the right solution. I wouldn't overthink too much the cleaning part unless it would cause a memory leak, let's leave Node.js do its job. @stuartambient beware of Zalgo when emitting the |
Sure, is there a way to provide pull requests to wiki's? Could not find any. |
I'll throw 3.2 out. https://gist.github.com/stuartambient/7485f29ace060eb6600ca61195d590a6 |
@enricoschaaf, @stuartambient I think I finally managed to configure the wiki correctly. Can you tell me if you can see the "edit" button now? Thanks |
The link went straight to a new page form. I added some stubs so the home page has the stub pages in the right panel. Buttons for edit / new are there as well. Problem though is the link above is now just a page in the TOC. It didn't keep it as the wiki home page. I think maybe only the repo owner would be able to change it. |
Works👍 |
updated my 3.2 if it's helpful - https://gist.github.com/stuartambient/7485f29ace060eb6600ca61195d590a6 |
@stuartambient, I added your solution to the list :) |
Solution 3.4 https://gist.github.com/stuartambient/d7f4c16fb7af21b2ae8197bfabcb7ac1 |
I am copying them to this wiki page: https://github.com/PacktPublishing/Node.js-Design-Patterns-Third-Edition/wiki/Node.js-Design-Patterns-Third-Edition---Exercise-Solutions You should be able to edit it if you want to add more in the future :) |
Hey @stuartambient and @enricoschaaf, looks like we're all at about the same point in the book. Would either of you be interested in starting a Gitter or something like that to chat about what we're learning and help each other figuring out solutions to the EOC problems? |
Hey @Jack-Barry, @stuartambient & @enricoschaaf. I love the idea of offering a place for readers to discuss. I just enabled "GitHub discussions" on this repo (https://github.com/PacktPublishing/Node.js-Design-Patterns-Third-Edition/discussions). Do you think this can help you or do you prefer something like a chat (slack or discord style)? |
@lmammino That should work, I didn't even know about that feature in GitHub. That should make it easier for anyone using this resource to participate without having to have an account for another service. Thanks for setting it up! |
@Jack-Barry thanks for reaching out. I also agree that the discussions here would work fine. Personally I've been working slowly through the book. I know that this book has come up in a few recent r/node threads and got positive comments and upvotes. |
@stuartambient Thanks for the heads up, I'll keep an eye out in r/node. I've started a discussion thread for Chapters 4 & 5 here. I'm reading through Chapter 6 but haven't completed exercise 5.3 or 5.4 yet. 5.3 seems easy enough, 5.4 looks a little more involved so I might not get through it until after the holidays |
Haven't seen them on packt or here, maybe they don't exist ?
The text was updated successfully, but these errors were encountered: