Yes, SimonhasgivenanexcellentsuggestionforDoctorhedrum, whichis a cubewithfacesconnectedup.
I woulddefinitelyliketogettothatatsomepoint, but I don't knowif I'llgettothattoday.
I am.
I'm excitedtopremieresomething.
Wait a second.
Uh, I havetowaittill I get a message.
Like I havetocreatethefakescenario.
Um, forthethingthat I want a premiere, Wait a second.
Breakingknowsnews.
Breakingknowsthisisnotgoingwell.
Howdo I turnmybrainon?
There's gottabe a waytoturnmybrainon.
Youknowwhat I thinkis a waytoturnmybrainoncoding?
Let's justgetstarted.
Sooneofthethingsthat I wanttodotoday, um, andletme, umletmegotosevensegmentdisplay.
Actually, youknowwhat?
Let's let's take a momenthereandgotothecodingtrainwebsite.
Youknowwhat?
I thinkthewebsitemightbebrokenbecauseit's supposedtoshow I think a noteherewhen I'm livestreamingandthemostrecentlivestreamthatit's showingisforMarch 14th.
SoOctoberFestivalwantstohelpfixthisonthewebsite.
Thatwouldbe a goodthingtofix.
Um, but I wantThio.
Comeherefor a second, Okay?
So I recentlydid a codingchallenge.
Sevensegmentdisplay.
Um, andlookatthis.
Thishasbeenreallysuccessful, inmyview, inthesensethatitinspired a lotofcreativepossibilities.
Onethat I reallywanttolookat.
Shecan I justdo a searchonTwitterwithoutloggingin?
Maybe I canloginasthecodingtrain.
Yep.
Thatwasaneasywaytodoit.
Andtherewego.
Thisisactuallywhat I'm lookingfor.
A lovethisfromSebastianVeinnode.
Uh, sevensegmentdisplaycombinedwith p fiveJsandmatter.
We'vegot a processingsevensegmentdisplay, so I shouldreallyjusttobe a goodperson.
Let's let's actuallyrunthiscode.
Thisistheonethingthat's a littlebittricky.
It's a littlebitharder.
Thisisjustactually a rawport, so I don't actuallyknow.
Soweneedtorunthis.
Thislookslikeit's justrawport.
Thankyouforthatondhe.
Thenwe'vegottheobjectorientedrefactoringesothis.
Let's take a lookatthisbecause I havetosay I takethisas a badgeofhonor, butmostpeopleareverynicetomeinthecomments, but, um, I get a lotofthenegativecommentsthat I get, which, honestly, viewisnegative.
Butoneofthethingsthat I liketoemphasizeandthat's partofmyprocess, which I recognizedmaybeisn't foreverybodyisthatmessinessispartofplayfulexperimentation.
Thesearevaluableandimportantskills, butsometimesyouwanttoplayaround, makeupanidea, and I alsoviewitas a prompttotheviewertothinkaboutwhat I'vedonewithmycodeandmakeandchangeittoworkforyou, andthatcouldmeanorganizeit.
Butlet's justsay I wanttoputtwonexttoeachotherand I maketwoofthemand I wanttodisplay a digitupdate.
Youknow, theseaircountingandmaybe I wanttoalsodisplay a digit.
Maybe I'llsaylike 10 minusindexorsomething.
Nowwhat's goingonhere?
I don't actuallyseetwoofthem.
Sothisiswhere I mightofferanideaforimprovement, whichisthatthe, um, theoffsetvectorishardcodedhere.
Sowhatif I wereabletogiveitan X and a Y, then I couldaddthe X and Y here, thenunderinsketch, I couldsayLet's haveoneat, likezerozerocommazeroandlet's haveoneat 100 commazeronow, interestingly, havestillnotseeingtwoofthem.
Let's see, likeright.
Whydon't I seetwoofthem?
Well, let's take a lookathowit's drawingtheoffsetVectorwhipsinsevensegmentdisplay.
Thisis, like, kindof a privatevariablehere, butitmustbeusedsomewhere.
Um, let's gobacktojustformedbyforeignersbothermethatit's offthe, uhandnowlet's do 100.
Soitmovedthisbothofthemover.
SoalsointerestinglyOh, youknowwhat?
Howwhereisthebackgroundbeingdrawn?
Let's I thinkthere's alsoanissuewiththis, whichis a problem, whichisthatthebackgroundisbeingdrawnhereinupdate.
Sothisis a problem.
Becausewhentheway I thinkaboutobjectorientedprogrammingisthat I onlywanttheobjecttoknowaboutanddothingsthatarepartofthatobjectitselfandbackgroundisnotpartoftheobject, backgroundispartoftheworld.
Itwouldbeniceifthe p fiveeditorcouldkeeptrackofwherethiscamefrom, but I'm gonna I'm gonnadothatmyself.
Thiswasfrom, uh, object.
Ordinaryfracturing.
Solet's buyBruel.
Solet's a credit, Bruel.
Ah, Andoverhere.
Soifanyonewantstotake a lookatthis, um, revisedfromBrueljusthere.
Andalso, let's creditthisGethomepage.
Allright, sothisisthething.
ThisisreallythisisthatHere's animportanttidbitthat I believeinwithallofmyheartandsoul.
Andif I evermakehim a stakeinthisrealm, pleaseletmeknow, um, opensourceis a thing, and I encouragemystudents, forexample, touseopensourcecodeexamplesinthecreationof a projectandwhateverthelicensemightberight, youmightfindlicenselikeopensource.
Licensingis a big A topicuntoitselfthatwouldbelovelytodiscussindepth.
Actually, onethingthat I wantedtoalsomentionhousekeepingwiseistherehavebeensomerecentimprovementstothecoatingtrainwebsite, whichisprettymuch a communityproject.
Ay, ay.
Diowouldliketoapologizethatthereare a lotofopenpullrequestsandissues.
I reallyneedtodo a betterjobofmaintainingthiscommunityproject.
And I'm hopingtofigureoutwaysinthefuturetogetmorepeopleinvolvedinthatmaintenance.
Sothisis a featurethataddsanoptiontoinclude a linkto a codingchallenge, ourtutorialwiththeWebeditor.
Soif I lookatanyWebpage, forexample, thissevensegmentdisplayone.
Let's comebacktothis.
Hereyoucanfindweird.
Wasitbroken?
Hey, we'rethebuttons.
Thereshouldbelikebuttonstolikedownlow.
I wonderifwebrokesomething.
Um, I did 10 minusinthatpeopleare a littledoneofgetting a notefromthechat.
10 minusindexiscausing a bitof a problemwiththis, whichisthat 10 minuszerois 10.
And I wanttogofromninedowntozero.
Sothisshouldreallybe, uh, 10 minusindexminusone.
Thatshoulddothetrick.
Right.
321 Not.
Yeah.
Therewego.
Okay.
Thankyouforthat.
Backtowhat I wassaying.
Weird.
Wherediditgo?
Let's goto a differentchallenge.
Like, forexample, Um, let's gotocodingchallenges.
Andlet's goto, like, thisonealso.
Let's gohere.
Okay, sothisoneis, hasit?
I don't knowwhyitwasn't showingup.
Andnowthere's tworowsofbuttons, whichisweird.
Somestuffgotmessedup.
Hey, peoplefeelfreetofile, getupissuesandpullrequests, but, umSowhat's supposedtohappenhereisthatthereis a linktoviewthecode, which, if I clickhere, willtakemetothegethubpagethathastheactualcode.
Thereis a linktodownloadthecode, which, if I clickthatwilljusttriggeranautomaticdownloadofthecodeas a zipfile.
Thisisprocessing.
Thenthere's live.
Examplenowlive.
Example.
Thisisnotactive.
LiveExampleshouldpointtothe P five j s versionthatrunsinthebrowser, and I'm notsurewhythereisn't onefortheLisaDukerdeliciousZukercurvetable, butthere's alsothis.
Oh, andlookatthis.
Thisnowviewcodepointstothe P five.
JessWebeditoroneright, whichwas a newfeature.
AndthisonepointstothewebeditorLiveversion.
Look, Attthat.
So I gottacleanthisup, figureoutwhatshouldbehereandwhatshouldn't ProbablyThisshouldbe.
I'm thinkingaboutit.
Um, viewcodeisalwaysnicetogotosomegethub.
Repodownloadcodeisnicetohave.
Right, Sothisgivesyou a zipandthen, um, I wouldsaytheliveexample, I shouldprobablygotothe P fiveJessWebeditorifit's there, ororgethubpages.
U R l Ifthere's no p fivejustWebeditororthannothing, it's deactivated.
Ifthereisnolifeexample, Soandsothismightbeprocessingoror P five.
Andthenwhat I couldusehelpwithactuallyisgoingbackinalltheoldchallengesthatdon't have a P fiveWebeditorversionofthemactuallycreatingthem.
Nowhere's thethinginorderfromforyoutodothis, though, I needtogiveyouaccesstothecodingtrain P fiveWebeditoraccountbecause I thinkitwouldbeniceforthistoshowupundertheunderthecodingtrainaccount.
Oneofthethingsthat I knowthat's a blackscreenrightnow.
I willfixthatin a second.
Oneofthethingsthat I didwiththesevensegmentdisplayisinthesevensegmentdisplay I pickedupHexiDecimalNumbersRacer, Thisis a papertowel.
Where's myniceeraser?
I pickedupHexidecimalnumbersfromthe, uh, fromtheWikipediapageaboutsevensegmentdisplay.
And I convertedthosehexImmeldecimalnumbersintow, binarysortofanddidbitshiftingandbitmaskingonthem.
And I kindofglossedoveron a hand, waivedtheexplanationofbitshiftingandbitmasking.
Andoneofthecomments I gotwas I didn't understandthebitspart.
Sowhat I'm gonnadotodayis, youknow, I thoughtlike a Letmejustdolike a oneminutebinarynumberstutorial.
I thinkthosekindsofthingsexistonYouTubealreadyonprobablyarebetterthanwhat I coulddobecausethey'reexplainervideoswithanimationsandsortofthoughtfuldiagramming.
Andsowhat I thoughtthat I woulddoisduetocodingchallengesaroundbinarynumberstoday, and I wouldbasicallymakeaninteractivedisplaytoconvertfrombinarynumberstwodecimalnumbersandback.
Andthen I wouldexplainwhatbinarynumbersareandthenalsolookatbitshiftingandbitmaskingaspartofthis.
So I don't That's exactlytheentireplanthat I have.
I didn't trycoatinganyofthisinadvance.
Sothisiswhat I'm goingtodo.
And I thinkthatdoingthisintheWebeditorwillbefine.
There's definitelysomecomplicatedaspectsofthis.
Letmecloseallthesewindowshome.
Savethis.
There's anissue.
Bytheway, A currentopenissuewiththe P fiveWebeditoristhatifyourename a sketchevenifyousavedit, itreallythinksthatyoudidn't saveit, buthowitusedtogo.
I'm usedtothat.
Okay, Sobinarynumbersbasedtoo, andbitsandbytes.
Okay, letmegetthechatopenheretomakesure I haven't missedanything.
Somebodyevery I don't usuallydothismanyretakes, buttodayitjusthappening.
Okay?
Previousonewasbetter.
Oh, it's thefakeenergyandenthusiasm.
Ah, mygoodness.
Allright, reallyenergy.
Thisisauthenticenergyandenthusiasm.
I amgenuinelyexcitedtotalkaboutbinarynumbers.
Don't.
Helloandwelcometo a codedchallenge.
Thiscodingchallengeis a codingchallengeaboutbuyingMarynumbers.
Okay, whyam I doingthis?
Well, previously, I did a codingchallengecalledthesevensegmentdisplaywhere I madethesevenseconddisplayinordertomakeit, I didtheseweirdoperationswiththisgreaterthangreaterthaninthisampersand.
Sofirst, uh, but I needtomakethese a codingchallenge.
Sowhat I'llactuallydo?
Letmetry.
I thinkwhatmightmakesenseistobuild a littlevisualizationsystemwhereif I typein a numberofdecimalnumber A regularnumber, I'lltalkaboutwhat a decimalnumberisn't a second.
Then I seeitinbinary.
Andmaybe I couldclickonthebinarynumberandchangethebitsandthenhaven't convertedbackanddecibel.
That's what I'm gonnatrytodo.
SoOkay, so, uh, ifyouneverheardaboutbinarynumberswelcome.
I amgoingtoattempttoexplainfirstofallbeforeevenexplainedbinarynumbers.
We'vegottaunderstandthisconceptof a base.
Thebase A number A numbersystem, like a base 10 or a base 16 or a base 64 base, too.
A numbersystem.
Thebasereferstothenumberofpossibilitiesofdigitsthatyoucanusetoencode a particularnumber.
Wehavenowconvertedbetweenbuying a representationanddecimal.
Okay, let's go.
Now.
andwritethecodetoactuallydothis.
Andalsolet's visualizeit.
Allright.
Solet's startwithjust a numberwhichequals 01011010 OK, andnowwe'regoingtowrite a functioncalledbinarytwodecimal a decimal, andit's goingtotake a value.
Andwhat I needtodoisjustloopoverallthedigits.
Andagain, there's allsortsoffancywayswecouldprobablyonelineofcodewith a higherorderfunction, butwe'regonnadothisinthelongwindedwaytoreallyunderstandit.
I equalszero.
I islessthanvaldotlength, I plusplus.
Actually, here's thething.
Ifmydeathbinarynumberis a string, I actuallywanttostartatthisdigitfirst, right?
Because I want I don't thinkthiscouldbeanygivenlength, but I want I wanttoaddthings, startingcountingit.
Zero.
Sowhat I mightdohereisactuallysaynowtheindexequalsvaluedotlengthminus, I minusone, right?
Solet's saythere's eightofthem.
I when I zero I wanttolookattheseventhwhen I isone.
I wanttolookatthesix.
When I wastwo.
I wannalookatthefifth.
Sowe'vegotthisnowAll I needtosayis, umletmegetthebit.
Is a valuecarat, um I SarkaratIndex, I wanttogetthat.
Isit a zeroorone?
And I alsoneedtoturnitinto a number.
Justcontinuespartsintoforthatwhichbydefault, willturninto a 01 indecimalwithoutany.
Andthen I'm goingtosayon I need a sum.
Someequalszero.
Then I'm gonnasaysomeplusequalpowertwotothepowertimesbit.
So I'm basicallydoingexactlythis.
I amsayingfourwhen I zerogotothisbit, whichisthelastcharacterinthestring, andthenmultiplyitbytimestwototheicepowershoot, thenmultipliedbytwototheAIFpower.