<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zain Raza on Medium]]></title>
        <description><![CDATA[Stories by Zain Raza on Medium]]></description>
        <link>https://medium.com/@zain-raza?source=rss-b9c6a8cd1b33------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Th1nZ-_ULj3KSEbVQPNRJA.png</url>
            <title>Stories by Zain Raza on Medium</title>
            <link>https://medium.com/@zain-raza?source=rss-b9c6a8cd1b33------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:34:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zain-raza/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From RANSAC to ResNet: A Brief History of Computer Vision]]></title>
            <link>https://zain-raza.medium.com/from-ransac-to-resnet-a-brief-history-of-computer-vision-9fabc71f4a24?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fabc71f4a24</guid>
            <category><![CDATA[computer-science-history]]></category>
            <category><![CDATA[scene-understanding]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[stevens-institute]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Mon, 25 Dec 2023 21:23:57 GMT</pubDate>
            <atom:updated>2023-12-26T13:08:48.348Z</atom:updated>
            <content:encoded><![CDATA[<h3>Table of Contents</h3><ul><li><a href="#d10a">What I Learned Over an Entire Semester of Grad School, in 13 Minutes</a></li><li><a href="#20d2">Part I: Classical Era (circa 1982–2012): The First Principles of Computer Vision Emerge</a><br>- <a href="#32d2">Geometric Computer Vision for Scene Understanding</a><br>- <a href="#013b">Geometric Computer Vision for Classification</a></li><li><a href="#013b">Part II: Deep Learning Era (post-2012): Implicit Representations Drive Computer Vision Forward</a><br>- <a href="#043e">Deep Learning for Scene Understanding</a><br>- <a href="#e449">Deep Learning for Classification</a></li><li><a href="#58e8">Conclusions</a></li><li><a href="#3118">Further Reading</a></li></ul><h3>What I Learned Over an Entire Semester of Grad School, in 14 Minutes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J44P9nXVuvYqLgU4O2y8zg.jpeg" /><figcaption>Like the pyramids of Egypt, computer vision history carries many secret treasures. Photo by <a href="https://unsplash.com/@nypl?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">The New York Public Library</a> on <a href="https://unsplash.com/photos/grayscale-photo-of-pyramid-and-camels-in-the-desert-5lpbC64r3Z4?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a>.</figcaption></figure><p><strong>Disclaimer</strong>: you can’t understand the entirety of computer vision (abbreviated “CV”) in 14 minutes. But this blog will at least give you a deeper intuition of things.</p><p>For context, 5 months ago I <em>thought </em>that I knew CV pretty well. After all:</p><ul><li>I used to teach people <a href="https://colab.research.google.com/drive/1FfdNsPv_UTl4zdWhk2ue1Zl48rqwEpq5?usp=sharing">how to implement a 2D convolution function</a> of their own in Python as a TA in undergrad.</li><li>I designed, and built a prototype sentiment classifier using TinyYOLOv2 for a research project at <a href="https://medium.com/dev-genius/digital-avatars-the-next-leap-in-remote-work-c72c0cd369a7">iQ3Connect</a>.</li><li>I joined PTC, and currently work on MLOps for the team that is working to improve the capabilities of Windchill+ for <a href="https://www.ptc.com/en/resources/plm/infographic/save-millions-on-reuse-quantify-lifetime-of-a-part">certain use cases</a> (which are out of scope of this post) that heavily rely upon metric learning in CNNs.</li></ul><p>The point is, even though I thought I knew a lot — the truth is, I was actually only familiar with the <em>deep learning </em>era of CV. And then grad school happened.</p><p>But there’s more to this field than that. This past Fall 2023 semester gave me a tremendous wake-up call to the <em>classical </em>era of CV. I think that’s important to share, because when I tell people I’m studying CS 558, aka Computer Vision (CV) at <a href="https://www.stevens.edu/">Stevens Institute of Technology</a>, it usually sparks the same kinds of follow-up questions:</p><ul><li><em>Could you explain the kinds of models you work with?</em></li><li><em>How would you go about solving [insert problem] in my domain? (usually, </em>my domain<em> is something like robotics, computer graphics, etc.)</em></li></ul><p>These are the big picture questions of CV; and getting familiar with the various answers that people have come up to approach them over the years will help you better appreciate CV, from the automated object recognition in the Photos app on iOS, to photorealistic 3D reconstruction included in <a href="https://youtu.be/mi-rBXrMzBQ?si=3ass8U4f-drp-BLo&amp;t=156">several XR apps</a> today.</p><p>So let’s get started!</p><h3>Part I: Classical Era (circa 1982–2012): The First Principles of Computer Vision Emerge</h3><p>Images are all around us. But images don’t just happen. There’s a gargantuan variety of environments, events, cultures etc., that are captured on the cameras today, whether they be on our phones, mounted atop traffic lights, satellites in space, etc.. The study of how such images are created in the real-world might be called <strong>computational photography </strong>nowadays<strong>. </strong>Or, if they’re created in CGI environments, then that probably falls under <strong>computer graphics.</strong></p><p><strong>But, </strong>we’re not here to look at how images are created. CV studies how to go in the <strong>opposite </strong>direction of image formation: image understanding.</p><p>In a sentence, CV is the study of how computers can take a certain image, and process it enough to understand the source environment in which it was taken, whether it be in terms of <strong>geometry</strong> (i.e.., the shapes in the scene), <strong>semantics</strong> (i.e., the names of objects in the scene), and more.</p><p>This understanding is impacted by how well we know how CV works. In the classical era, we tried to figure that out by answering a few <strong>key questions:</strong></p><ol><li>How do we pick out the most useful aspects of an image (i.e., features) for the purpose of ML?</li><li>How do we describe the features of an image using math (e.g., parametric models for shapes like lines)?</li><li>How can we track those features, if we’re given a dataset of images that are of the same scene, but are taken from different viewpoints?</li></ol><h3>Geometric Computer Vision for Scene Understanding</h3><p>Imagine this: you’re scrolling through the National Geographic’s account on Instagram. You come across an image of something like this <a href="https://www.instagram.com/p/CzBazusO_WD/?utm_source=ig_web_copy_link&amp;igsh=MzRlODBiNWFlZA==">young polar bear in Norway</a> — instead it’s not a normal image. A normal image is a static, flat 2D photo — but what’s on your display is a moving photo, akin to one of the portraits in Hogwarts Castle. It lets you rotate around the polar bear, and truly see the world from its point of view.</p><p>If you can imagine such a piece of content, you’ve just taken your first steps in grasping the promise of <strong>scene understanding</strong>.</p><h4>Data Preprocessing</h4><p>Let’s say we have a dataset of images. Great. What are we going to do with them?</p><p>Well, let’s step back: If this was an intro course on ML, what would we do (let’s say, if someone handed you a dataset that was just a CSV file) — you’d <em>preprocess </em>it! Duh :)</p><p>The same answer applies in CV. The most common way of preprocessing images is to apply <em>filters</em> to them. And what are filters?</p><ul><li><strong>High school answer: </strong>it’s a box of numbers</li><li><strong>Undergrad answer: </strong>it’s a tensor, that we dot with the image to distinguish certain features that we care about</li><li><strong>Grad School answer: </strong>it’s a discrete representation of a 2D kernel function, the convolution thereof with the image results in a response function that’s more amenable to further CV processing</li></ul><p>(OK, I admit these 3 answers above all refer to the same thing, but I made the grad school answer above arbitrarily complex and wordy. The grad students will appreciate the dry humor here though :).</p><p>What are some things filters can help us do to images? Well, think of the use cases we have for preprocessing in other domains of ML:</p><ul><li><strong>Denoising an image</strong></li><li><strong>Normalizing values </strong>(in this case, of the pixels in the image)</li></ul><p>Since we’re dealing with images, there are some unique use cases for preprocessing as well:</p><ul><li>Emphasizing contrast between the left/right sides of an image</li><li>Blurring an image (which oddly enough, can sometimes be one of the techniques we use for image denoising)</li><li>See this <a href="https://setosa.io/ev/image-kernels/">blog</a> for more details / interactive visualizations</li></ul><h4>Feature Engineering</h4><p>Ok! So we can preprocess the data we want to use for some algorithm. Are we ready to do some CV?</p><p>Not. Just. Yet. Oftentimes, even a filtered image has too much useless information to be practical for CV. This was especially true in the classical era, when datasets tended to be smaller than the ones we have today (looking at you, ImageNet) — thus, we need a way to further distill our images down to just the features that will be the most useful to learn on.</p><p><strong>Gradient-Based Image Feature Detection</strong></p><p>The two most common types of features we want to detect in an image are arguably edges and corners (note that corners are just a special kind of edge, so it’s really 1 type). They could be found using the approaches below:</p><ul><li><a href="https://youtu.be/hUC1uoigH6s?si=E_HnmgnR5vjQemGi">Canny Edge Detection</a></li><li><a href="https://youtu.be/Z_HwkG90Yvw?si=-ydIdrv4H7TQzmwD">Harris Corner Detection</a></li></ul><p>They work by using the gradient of an image, which can be computed by special kinds of filters. Their output is just a new, transformed version of the image.</p><h4>Parameter Estimation (aka Model Fitting )</h4><p>A note on language here: for a lot of us coming to CV with a background in ML are used to hearing the words “fitting”, and thinking of the training step of some ML algorithm, e.g., support vector machines. But in classical CV, a model can refer to much more than that — in this case, we’re talking about <em>geometric</em> models — e.g., think of an algorithm that could tell you where all the lines in an image are. This is taking a step beyond something like the edge detector (as mentioned above), as we can generalize the approaches to virtually any kind of geometric shape — that’s why classical CV is often conflated with the term “geometric CV”. The other strength of these kinds of approaches is that we can encode the detected features mathematically — this allows for a much more compact representation, that just depends on a few parameters (e.g., the slope and intercept, if we’re talking about a line model).</p><p>Here are some of the main techniques to highlight here:</p><ul><li>Least Squares</li><li><a href="https://youtu.be/EkYXjmiolBg?si=HPHJ_X7UyVMa3jq9">RANSAC</a></li><li><a href="https://youtu.be/XRBc_xkZREg?si=U8Wydva4ystQ3BUE">Hough Transform</a></li></ul><h4>Image Alignment</h4><p>One of the major problems we want to solve in scene understanding, once we can find features in one image, is: can we track how they would move, as a function of moving the camera around the original 3D scene where the image(s) were first captured?</p><p>There are lots of subproblems in the field of scene understanding. Namely, the one we studied in the CV course at Stevens was image alignment. To elaborate, you’ll learn how we can “stitch” together photos that are of the same scene, but one has slightly been shifted to the left/right, so that they form a larger panorama (see example image below). Using what we know so far, this actually isn’t too bad to implement — it comes down to detecting features in both images, using a model fitting technique (e.g., RANSAC) to estimate an unknown function representing the camera motion between the two images, and then using matrix math to overlay one image on top of the other, as appropriate.</p><p><em>Example: </em>Aligning Two Images of a Two</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*g4eUtbZ-yhgV_CxT" /></figure><p><em>Step 1: Have 2 images of the same scene that have an overlapping region.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/0*Ul0Z5rCY0fUCqL-6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/0*R5Drq50et1h72taS" /></figure><p><em>Step 2: Detect the features in each image (in this case, we use Harris corner detection).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/0*3N2wfQNlecep_-9d" /></figure><p><em>Step 3: Estimate the parameters of the shift that transformed the image from the left to the right.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*Nphqh8r8WdOVHhPi" /></figure><p><em>Step 4: “Stitch” the two images into one, so that they show 1 unified panorama.</em></p><p>As this example shows, using geometric techniques we can learn a mathematical representation of the camera motion taking place in between the images of a given dataset. This idea plays directly into the approaches for higher-dimensional scene understanding, like <strong>Structure from Motion (SfM) </strong>. After all, if we can sufficiently “reconstruct” a panorama of images in 2D — then in 3D, why shouldn’t we be able to reconstruct full holograms of real-world scenes, if given enough data?</p><p>(Hint: there is a whole area of active research in this area. For those looking for fun deep learning<em> </em>projects to work on, please explore using tools like <a href="https://docs.nerf.studio/">NeRFStudio</a>!)</p><h3>Geometric Computer Vision for Classification</h3><p>Classification is another important and highly related to scene understanding in CV. Why? Because once we know how to detect features, those features can be used not only to estimate the relationships between images in a dataset; but also, to recognize what’s in the image itself.</p><h4>From Detection to Description</h4><p>Detected features are complicated. Alone, they are often hard to use for classifying objects, without first truly doing your homework to understand the nuances of your specific application.</p><ol><li>For example, let’s say you’re building an app to help kids eat more healthily. You want it to be able to recognize occurrences of fruits in an image. You could say you’re using color as a feature in your color — but then, how would you be able to tell an apple from a strawberry?</li><li>Alternatively, you might say you want to use scale… but then, how will you be able to recognize fruits when the camera zooms in or outwards?</li></ol><p>Questions like these are why we usually don’t use detected features by themselves — we build <strong>feature descriptors</strong> instead. Feature descriptors are an umbrella term, but it (informally) refers to any kind of representation we use to contain all the characteristics of a feature, that we want to look for in an image.</p><p>Feature descriptors can take many forms, but the simplest is usually creating a histogram. For example, a detected feature might simply be the texture you find in different fruits in an image. Whereas, a feature descriptor would be for each fruit, you create a histogram of the texture on that fruit. Why is that powerful?</p><ul><li><strong>Key</strong>: in the training phase of a classifier, if you take the histogram of textures for multiple fruits, then you have created a sort of numerical “index” of the dataset — this <strong>unlocks</strong> your ability to apply ML.</li><li>Continuing with the example, you could now take a new test image, extract a feature descriptor for one its fruits, and compare it to the histograms created during training. The one with the highest similarity can then be used to label the fruit in the new image!</li></ul><p><em>Sidebar: </em>the kind of data structure (i.e., the index of histograms) used to enable this kind of labeling is often referred to as a Visual<em> Bag of Words </em>(VBoW). For folks familiar with Natural Language Processing (NLP), the benefits/use cases of using this kind of representation are parallel with those of using a bag of words for text corpora.</p><h4>Another Example of Using a Visual Bag of Words: Image Data Association</h4><p>To make the idea of VBoWs more tangible, consider the additional scenario for segmentation: data association.</p><ul><li>Let’s say you have a dataset, maybe based on the popular <a href="https://github.com/alicevision/SfM_quality_evaluation">SfM Camera Calibration Benchmark</a>, that contains images of a whole bunch of different locations, each from a variety of different view points. Our goal is before even classifying the objects, we’d like to reorganize the images such that images of the same location, are grouped together.</li><li>For the data scientists in the room, this is a good scenario in which to apply clustering!</li><li>To do this, we started by describing features. In this example, our descriptors for the features in a <em>single </em>image will be more sophisticated than using a histogram. Instead we’ll use SIFT (a popular technique described in the <a href="https://docs.opencv.org/4.x/da/df5/tutorial_py_sift_intro.html">OpenCV docs</a>).</li><li>After that, we need to go a more “global” representation of the image — that is, we create a histogram of the SIFT features in each image — this will act as our VBoW across the dataset.</li><li>Finally, we will use a technique like K-Means to group the photos into location-wise groups.</li></ul><p>Why is that cool? When visualizing the images, we might see we have photos of 1 scene that has a tractor, next to photos of a totally different scene with something like a water fountain. This heterogeneity makes scene understanding much more difficult. But after using an approach like this, we can visualize one of the K clusters our algorithm automatically found, and see that they’re all from the same scene:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HOHk78JbHjXAgGij" /></figure><p><em>A cluster of images automatically found by applying K-Means clustering to a set of VBoWs of an image dataset, with multiple different locations.</em></p><h3>Part II: Deep Learning Era (post-2012): Implicit Representations Drive Computer Vision Forward</h3><p>Time moves on, neural networks take off in 2012 thanks to the <a href="https://paperswithcode.com/method/alexnet">breakthroughs of Geoffrey Hinton’s lab</a>, using neural networks specifically for CV. New key questions arise in the field:</p><ol><li>How do approaches for image classification that use deep learning differ from those in the classical era of CV?</li><li>How are they similar?</li></ol><h4>Deep Learning for Scene Understanding</h4><p>The course at Stevens actually didn’t go too <em>deep</em> into this area during the semester. So we’ll leave it as a question mark for now.</p><p>(Brownie points if you caught the pun above :).</p><h4>Deep Learning for Classification</h4><p>To recap, in the era before deep learning became ubiquitous in ML, image classification pipelines boiled down to something akin to the following:</p><ol><li>Data Preprocessing</li><li>Feature Engineering (Detection + Description)</li><li>Using some kind of ML algorithm (most commonly an SVM, or Ensemble like Random Forest) to predict labels by comparing the index of descriptors built up in training, to those computed on test images.</li></ol><p>On its surface, image classification via deep learning may seem like a mysterious black box — but the truth is, the rules of this game don’t change!</p><p><strong>Rise of The CNNs</strong></p><p>CNNs are a type of deep learning model developed specifically for dealing with images. They have been popular since 2012 till this day (even with the rise of more modern approaches like transformers). They essentially build on the three-step process used in the classical era:</p><ol><li>Automate the process of engineering features for classification (i.e., steps 1 and 2 above), as we’re no longer handcrafting them manually.</li><li>Get an output prediction at the end (same as step 3 above).</li><li>Use an iterative optimization technique called <strong>backpropagation through time </strong>to eventually reach a high accuracy.</li></ol><p>What’s unique to CNNs is how they do step 1 above — what is the replacement of hand-crafted feature engineering? <strong>Convolutional layers.</strong></p><p>At a high level, <strong>convolutional layers </strong>are a set of trainable filters used to preprocess a set of images. As we learned above, filters are used to transform images into a representation more amenable for learning. So once they are optimized, CNNs can achieve stunning resulting in terms of robust generalization, for applications like image classification (more details on this will be linked in the “Further Reading” section below).</p><p>Towards of the end of this part of the course, Stevens discussed several famous CNN architectures:</p><ul><li><a href="https://paperswithcode.com/method/alexnet"><strong>AlexNet</strong></a></li><li><a href="https://paperswithcode.com/method/vgg"><strong>VGG</strong></a></li><li><a href="https://paperswithcode.com/method/googlenet"><strong>GoogLeNet</strong></a></li><li><a href="https://paperswithcode.com/method/resnet"><strong>ResNet</strong></a></li></ul><p>For the sake of brevity, I’ll let you read into the technical details of these architectures on your own. The key takeaway is, research shows as time went, each of these models added more layers than the last. The more layers they had, the better performance they achieved, thanks to the power of convolutions.</p><h3>Conclusions</h3><p>To those of you who are curious about CV, and ask questions — we’ve come full circle. Because when I tell people I’m studying Computer Vision (CV) at Stevens Institute of Technology, I usually get asked the following kinds of questions:</p><ul><li><em>Could you explain the kinds of models you work with?</em></li><li><em>How would you go about solving [insert problem] in my domain? (usually, </em>my domain<em> is something like robotics, computer graphics, etc.)</em></li></ul><p>And the answer I give is: CV is about more than just understanding the various models and techniques. And that there are numerous applications that don’t necessarily have to be related to robots navigating deep sea environments, or AR/VR — it could be a simple app you make to help kids eat cleaner.</p><p>As I write this, there are still so many unanswered questions in computer vision. Questions for you and I to keep exploring, and (as I would encourage you) to keep trying to solve. And then someday, maybe you’ll be in the pages of CV history as well. :)</p><h3>Further Reading</h3><ol><li>Big shout-outs are in order for my CV professor (and his TAs) at Stevens: <a href="https://enriquedunn.github.io/">Professor Dunn</a>, <a href="https://siyuancao18.wixsite.com/tony">Siyuan</a>, and <a href="https://scholar.google.com/citations?view_op=list_works&amp;hl=en&amp;user=ZU9JhNYAAAAJ">Liyan</a>. Please go follow their work, as they are active contributing researchers.</li><li>This is the <a href="https://github.com/sraza-onshape/CS-558-Computer-Vision">repo</a> for the code I implemented in the course. Admittedly it’s a little messy, but please feel free to make PRs (and/or <strong>leave a comment if you would like a future blog on any of the modules, as this post was intentionally light on the coding details)!</strong></li><li>Get a better intuition for how 2D convolutions (as used in CNNs) work through this post by Irhum Shafqat: <a href="https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1">Intuitively Understanding Convolutions for Deep Learning | by Irhum Shafkat | Towards Data Science</a>.</li><li>Better understand the pre-requisite Math for CV, through this self-paced course at Stanford: <a href="https://graphics.stanford.edu/courses/cs205a-13-fall/assets/notes/cs205a_notes.pdf">Mathematical Methods for Computer Vision, Robotics, and Graphics</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fabc71f4a24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Process I Personally Use to Understand AI/ML Research]]></title>
            <link>https://zain-raza.medium.com/the-process-i-personally-use-to-understand-ai-ml-research-f1590c04980d?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1590c04980d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Sat, 07 Oct 2023 01:58:01 GMT</pubDate>
            <atom:updated>2023-10-07T01:58:01.636Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-g6wmdryCLPrQwUTIY4Zg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@impatrickt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Patrick Tomasso</a> on <a href="https://unsplash.com/photos/Oaqk7qqNh_c?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>ML Research: It’s <em>All</em> About the Process</h3><p>By far, one of the hardest (and most rewarding) parts of grad school is learning how to engage with other researchers’ ideas. Being able to read papers in AI has helped me put together better <a href="https://youtu.be/b4LFaNivlEc">presentations</a> to present to professors, generate more ideas, and discover more niche, open problems in the field than many of my colleagues — but surprisingly, it’s a skill which <em>none </em>of<em> </em>my professors ever actually took the time to teach.</p><p>Today, I want to pull back on the curtain on how I read papers (and by extension, you could also apply this to taking lecture notes, textbook reading, etc.), so you don’t have to start from scratch when getting into research.</p><h4>Step 1: Set the Stage</h4><p>The way you start reading a paper is like how you start a workout: <strong>by warming up.</strong></p><p>In my case, my personal research interest lie at the intersection of computational imaging and <a href="https://www.youtube.com/watch?v=otly9jcZ0Jg">neural rendering</a>. <em>But,</em> at one point in grad school I was required to take a course in “statistical learning theory” — aka, an <em>entirely </em>different domain of research!</p><p>It’s not a good idea to jump into a paper before you’re really curious about what it contains. In my case, I frankly found this step challenging. Eventually, one thing I found helped motivate my paper-reading to peruse the websites of the authors my professor would assign, such as <a href="http://kunaltalwar.org/">Kunal Tawar</a> (a Research Scientist at Apple). That’s because even though I went in with the impression that reading about theoretical concepts is dry, Tawar’s work touches millions of devices through his role in privacy-preserving machine learning. Now <em>that’s </em>what I call having an industry impact!</p><p><strong>Key Takeway: </strong>in your own research adventures, before starting a paper try to take a few minutes to explore the author’s background and the paper’s context. This will help you frame the problem and its significance.</p><h4>Step 2: Outline Your Notes</h4><p>OK! So now we’re just juiced up our curiosity levels. How will we organize our notes?</p><p>In my personal experience, I like to follow the “Outline Method”, as presented by Thomas Frank <a href="https://www.youtube.com/watch?v=AffuwyJZTQQ">here</a>. In particular</p><ul><li><strong>write down headings using an ordered tree-list</strong></li><li><strong>and, along with that write down questions that personally curious for you to try and answer, <em>before </em>diving into the details in full</strong></li></ul><p>Of course, for this step you can choose just about any kind of outline that works best for yourself.</p><h4>Step 3: Decode the Language</h4><p>If you’ve ever picked up a paper and had <em>no idea </em>what the vocabulary meant, then you’re not alone! Researchers are notorious for using jargon that perhaps not even ChatGPT will recognize (for another example related to statistical learning theory, try asking it to define “the fat shattering dimension” for you, and see what happens :). Therefore in this step, we want to recognize the ambiguity, and take a moment to acquaint ourselves by:</p><ul><li><strong>study the figures + captions</strong></li><li><strong>look up any words in bold/italics/quotes that stand out</strong></li></ul><p>In other words, this step involves breaking down complex terms and techniques into manageable components. Visual aids like diagrams and flowcharts can be incredibly helpful in this regard.</p><h4><strong>Step 4: Capture the Core Contributions</strong></h4><p>Alright! Now we’re cruising. By now, you are probably starting to see through the darkness of <a href="https://en.wikipedia.org/wiki/Allegory_of_the_cave">Plato’s Cave</a> a little, but aren’t yet able to see the bright day outside. We’re now ready to fully take in this paper though. So the next steps are to:</p><ul><li><strong>read through the paragraphs in-depth</strong></li><li><strong>summarize to make sure you grasp the intuition and any key insights</strong></li></ul><p>The intention here is identify the paper’s core contribution, which could be a novel algorithm, an innovative framework, or a unique insight. Jot down the main problem being addressed, the proposed solution, and how it improves upon existing approaches. Think of this as the heart of the paper that you’ll want to retain in your notes for the long term.</p><p><strong>Pro-Tip: </strong>one thing<strong> </strong>I’ve noticed is the most advanced researchers pay special attention to one thing, that particularly garners deep insights about their field: they pay <em>close</em> attention to when the papers in a given domain, start referring to the <em>same</em> idea using <em>different</em> names over time. Going back to the NeRF example: if you watch this <a href="https://www.youtube.com/watch?v=Rd0nBO6--bM">talk by Vladen Koltun</a>, and notice how he stresses calling NeRF an implicit representation; and then you move this <a href="https://imagingtext.github.io/">textbook on NeRF</a> where it is part of a section called “Light Field Imaging and Display” — <em>that, </em>my friend, is a dead giveaway that NeRFs are becoming a topic larger than any single person can learn about all on their own. And that’s exciting, because the chances are the more chances there’ll be to find open problems for you to work on if your own research!</p><h4>Step 5: Embrace the Details</h4><p>Next strp — this is going to be disappointing. It is. But the truth is: there is no next step.</p><p><em>“Hold up, Zain — </em>what<em> do you mean, there’s no next step?”</em></p><p>What I mean is, there’s no next step that <em>everyone </em>should follow. What I’m trying to say is, everyone should try to read papers to at least get the core intuition. But after that step, how far deeper you go depends on your personal interests.</p><p>For me, there are some papers that are super relevant to a project/course I’m working on — in that case, this is the point where I revisit the sections that discuss the technical intricacies, assumptions, and experiments. I ask myself how each component contributes to the overall solution. I’ll scour the Web to seek additional resources (like online tutorials, lecture notes, or dope Medium articles on places like <a href="https://towardsdatascience.com/?gi=71571598c8a5">Towards Data Science)</a> to clarify concepts that seem challenging. But for other papers, this could just be the place where I stop entirely.</p><p><strong>Pro-Tip: as a stretch challenge,</strong> try to reproduce the results presented in the paper on your own also, using code provided by the authors (or better yet, contributing your own open-source implementation <a href="https://huggingface.co/">if there is not one already</a>)!</p><h4><strong>Step 6: Reflect and Relate</strong></h4><p>After comprehending the paper’s content, take a step back and reflect on how it relates to your existing knowledge. Can you draw connections to concepts you’ve encountered before? Can you answer any of the questions you wrote down in Step 2?</p><p>Even better, do you have <em>new </em>questions you want to explore :) ? This reflective step is crucial for synthesizing the new information and expanding your mental framework.</p><h4>Step 7: Engage in Collaborative Learning</h4><p>As <em>fun </em>as it can be to read papers (no sarcasm here at <em>all), </em>it is a lot more enjoyable to learn about papers together!</p><p>Engage in collaborative learning by joining discussions with peers and mentors. Online forums on Discord, seminars, and workshops are fantastic platforms to exchange thoughts and interpretations. Constructive debates can reveal multiple perspectives and provide a richer understanding of the paper’s nuances.</p><p><strong>Pro-Tip: </strong>for people interested in a NeRF paper reading group, I’d suggest looking into the Discord server for <a href="https://docs.nerf.studio/en/latest/">nerfstudio</a> :)</p><h4>Step 8: Foster Connections</h4><p>Lastly, reach out to the authors or researchers whose work you find intriguing. Craft thoughtful emails expressing your questions and/or appreciation for their contribution and your interest in their research. Establishing connections within the research community can open doors to mentorship opportunities, collaborations, and even friendships that will enrich your academic journey.</p><h3>Conclusion</h3><p>That’s it. Give me feedback on what you think of this process, want to see an example (perhaps in a future post?) or anything else. Happy reading! 🚀📚🧠</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1590c04980d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Industrial CAD Workflows: The Shipment Pattern]]></title>
            <link>https://zain-raza.medium.com/automating-industrial-cad-workflows-the-shipment-pattern-b00f55ca91ec?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/b00f55ca91ec</guid>
            <category><![CDATA[computer-aided-design]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[ptc]]></category>
            <category><![CDATA[onshape]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Sun, 16 Jul 2023 19:58:49 GMT</pubDate>
            <atom:updated>2023-07-16T19:58:49.191Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-DM8ibh55TjBPmJoonB_g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@timelabpro?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Timelab</a> on <a href="https://unsplash.com/photos/CfKV0CecnU8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>For those of us familiar with <a href="https://supporttest.ptc.com/help/flow/en/#page/flow/help/Welcome.html#">PTC Flow</a> (and if you’re not, please feel free to watch this <a href="https://www.ptc.com/en/resources/liveworx-on-demand/integrations-patterns-plm-for-the-digital-thread">LiveWorx presentation</a> on it, starting at 15:25) you know it can be a <em>powerful </em>tool to use to integrate different software systems used in an enterprise.</p><p>But, how would one actually use PTC Flow, for automating the transfer of their CAD data? As a software engineer at PTC, who worked on developing a connection between PTC Flow and Onshape over the past 6 months, I have sat in on many conversations with Onshape users, developed proof-of-concepts for PTC’s CTO, and collected other use cases. This had led me and my colleagues to coin all-new <em>design patterns </em>for using PTC Flow.</p><p>I want to share one such pattern with you today (again, <em>assuming </em>you already know what Flow is), as a way to give you a better idea on how it can accelerate your CAD workflows, by automating the workflows that usually would be done by hand. We call it — the Shipment Pattern!</p><h3>🌱 Pattern basics</h3><h4><strong>Title</strong></h4><p>The Shipment Pattern — it deals specifically with when you have a CAD model located in one system, and need to export — or <em>ship — </em>it to another system.</p><p>Just to those readers already experienced in software development — I would tell you that at a big picture view, this <em>Shipment Pattern</em> is not really anything new — it functions similarly to the more popular <em>Model-View-Controller</em>, or MVC pattern. Because the <strong>Model</strong> is whatever artifact(s) are stored in the source system, the <strong>View</strong> can be likened to whatever output you wish to send to the destination system, and the <strong>Controller</strong> is Flow itself. The name “Shipment Pattern” therefore is just here to communicate the specific problem we want to solve when building Flow-based integrations!</p><h4><strong>Description</strong></h4><p>“Using (PTC) Flow, a user orchestrates the export of a (potentially large) collection of artifacts out of one system, manipulates it in someway, and imports it into another system.”</p><h4><strong>Example Flows</strong></h4><p>Consider the example use case: you’re using Onshape in a startup; and you’ve decided to use Google Drive to backup all the data being authored in the CAD solution. When a change notice comes to the CAD engineers in Onshape, they set about making new revisions of the relevant CAD models. When they’re ready to send it back to the backup folder in Drive… wait, what <em>exactly </em>will they be sending back to Drive? And how will do it in a way that’s as efficient as possible?</p><p>The Shipment Pattern can help provide an answer here. Let’s walkthrough the two “flows” you’d probably create for this (if you’re using PTC Flow):</p><ul><li><a href="https://dev.atlas.ptc.com/flow/#/flows/53a4cfe0-decf-11ed-a952-ef939a980686/edit">Flow 1</a>: Given an Release Package (encapsulating the Onshape data), Flow requests Onshape to generate derivative CAD files for the relevant 3D models found in said release package:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0p8MXhfJQD74GNtv" /><figcaption><a href="https://dev.atlas.ptc.com/flow/#/flows/53a4cfe0-decf-11ed-a952-ef939a980686/edit">Flow 1</a>: Given an Release Package for a product, Flow requests Onshape to generate derivative CAD files for the relevant 3D models found in said release package.</figcaption></figure><ul><li><a href="https://dev.atlas.ptc.com/flow/#/flows/9921af10-e768-11ed-9452-4dae8ca7e7a6/edit">Flow 2</a>: Once all the CAD files are created, Flow imports them into a user-specified data store (in this case, Google Drive).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JwTFoTS6CnFSav0x" /><figcaption><a href="https://dev.atlas.ptc.com/flow/#/flows/9921af10-e768-11ed-9452-4dae8ca7e7a6/edit">Flow 2</a>: Once all the CAD files are created, Flow imports them into a user-specified data store (in this case, Google Drive).</figcaption></figure><h3>🧐 Pattern Specifications</h3><p><em>“Okay Zain, great. So I can send data out of Onshape to other systems. But in general, what would I need to have to </em>actually <em>do this in the real world???”</em></p><p>I like that question! Let’s get into the specifics a little deeper, so you could apply this pattern to your own use case:</p><h4><strong>Input</strong></h4><ol><li>Authorization credentials for at least 2 systems — the Source and the Destination</li><li>Pre-existing resources in the Source, that will be used to create the artifact(s)</li></ol><h4><strong>Steps of the Pattern</strong></h4><ol><li><strong>Commissioning the Workload: </strong>a request comes to the Flow, typically via a trigger or some other REST mechanism.</li><li><strong>The Workload: </strong>Flow will request the Source system to kick off some (ideally async) job to generate the artifacts that need to be exported.</li></ol><p><em>In the Example above:</em></p><ol><li>Onshape sends an individual webhook notification for each CAD file that gets created, which is basically a JSON payload. Our app extension’s <a href="https://github.com/sraza-onshape/OnshapeExperiments/blob/exporter-experiment/release-package-exports/api.js">web server</a> would be able to recognize that using an if statement, checking that the event field in the notification is set to: <em>onshape.model.translation.complete.</em></li><li><em>Then, </em>there’s a second if statement that checks once all the CAD files in the data store have been finished translating. At <em>that </em>point, it triggers the flow to do the final export into the destination system (see step 3 below).</li><li><strong>The</strong> <strong>Shipment: </strong>Once completed, then Flow will retrieve the artifacts and start importing them into the Destination systems. As a best practice, this Flow <em>should be async when possible!</em></li><li><strong>Output: </strong>once the import into the Destination system is complete, typically our Flow should send some kind of <strong>notification to the relevant stakeholder </strong>that they can now access those artifacts (e.g. via email)</li></ol><h3>➡️ Additional guidance</h3><h4><strong>FAQs</strong></h4><ul><li><strong>“What if the connector for the Source/Destination has a broken trigger?”</strong></li></ul><p>This has happened before. In that case, one workaround you can use is to have the Flow use a simple webhook trigger. Then, write a minimalist web server, that can call that Flow (using the URL of the afforementioned webhook) based on the appropiate conditions.</p><ul><li><strong>“During my shipment process, I must be able to intermittently update the state of my artifact(s). Any recommendations?”</strong></li></ul><p>Never to fear! We do have a precedent for this. We can get it to work based on writing relatively simple app extension for Onshape, which used an LRUCacheto track the state of the Onshape assets being translated. Please see <a href="https://github.com/sraza-onshape/OnshapeExperiments/blob/exporter-experiment/release-package-exports/api.js">this Node.js server</a> on GitHub for the full implementation. And see the <a href="https://onshape-public.github.io/docs/app-dev/extensions/">Onshape developer documentation</a> for more info on building app extensions!</p><ul><li><strong>“I have other questions about PTC Flow…”</strong></li></ul><p>…well, you are in luck, my friend! At PTC, we work cross-functionally to make sure our customers can mix-and-match how our offerings work, almost like the LEGO blocks we played with as kids. If you have feedback/questions about:</p><ul><li><strong>Integrating with Onshape</strong>: please see my last, introductory tutorial on that <a href="https://zain-raza.medium.com/how-to-build-your-own-3d-cad-model-viewer-for-the-web-b1fe65369b35?source=friends_link&amp;sk=325f62b123edf619db63e83b0a5efdc3">here</a>,</li><li>OR would like support on <a href="https://supporttest.ptc.com/help/flow/en/#page/flow/help/Welcome.html#">using Flow in general</a> — see the support docs <a href="https://supporttest.ptc.com/help/flow/en/#page/flow/help/Welcome.html#">here</a>,</li><li>for all other things: feel free to leave a comment on this post! I’ll be interested to hear what you think, and the kinds of automations you find interesting…</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b00f55ca91ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Product Deep-Dive: Spatial Search!]]></title>
            <link>https://zain-raza.medium.com/product-deep-dive-spatial-search-14f64b032488?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/14f64b032488</guid>
            <category><![CDATA[remote-service]]></category>
            <category><![CDATA[search-engines]]></category>
            <category><![CDATA[spatial-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[industrial-metaverse]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Sat, 20 May 2023 14:19:48 GMT</pubDate>
            <atom:updated>2023-10-28T20:46:25.996Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: opinions are my own and stories are presented from my own perspective. This is NOT official communication from PTC.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBj3imx-vRn9Z6sgGa2_nQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/de/@pluyar?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shane Aldendorff</a> on <a href="https://unsplash.com/photos/mQHEgroKw2k?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Special Credits</h4><p><em>Special thanks to </em><a href="https://www.ptc.com/en/about/reality-lab/team/valentin-heun"><em>Valentin Heun</em></a><em> for sharing his UI mockup for Spatial Search (shown below), and </em><a href="https://www.linkedin.com/in/marc-thomas-schmidt-35488710/"><em>Marc-Thomas Schmidt</em></a><em> for his help in describing its user journey!</em></p><h3>Section 1: The Industrial Metaverse — A Gentle Introduction</h3><h4><strong>Use Case of Interest: Re</strong>mote <strong>Service</strong></h4><p><strong>In this article, my goal will be to describe new capabilities being built by the <em>Industrial Metaverse</em> (abbreviated IMV</strong>) <strong>team at PTC (whom I have worked several times with over the 6 months) to try and fix the problems found in service solutions for industrial companies today. Let’s go.</strong></p><h4><strong>Industry Analysis</strong></h4><p>When speaking about the Industrial Metaverse, probably the first question on our minds is: why now? Let’s outline several forces that might be making 2023 a turning point for advancing the state of remote service:</p><ol><li><strong>Web-Based Integrations Between SaaS Solutions</strong>: web-based SaaS applications are nothing new — there’s a good chance you’re using one right now (thank you, Medium.com)! In the manufacturing space alone, there are so many software systems an enterprise might require to operate effectively: e.g., CAD, PLM, MES, ERP, FSM, and on and on. Having all these applications is great, but it can also lead to information silos between several systems of record (abbreviated “SoRs”). This then becomes an issue when adopting AR/VR solutions (in this case, remote service) — for instance, what if you need to bring 3D assets out of a CAD system, when answering a service call? Ideally, an enterprise should be able to pull that information out of their existing CAD data. If we can solve that “hand-off” problem for customers (more on that in just a moment), then the Industrial Metaverse can truly begin to immerse users; by providing <em>all</em> the same meta-information at their fingertips that’s useful in solving issues.</li><li><strong>On-Device ML</strong> <strong>on the Rise: </strong>limits on computing power and/or networking on mobile devices can also hinder communication over a remote service call. But, that issue might soon be a thing of the past. For example, with the emergence of Apple’s latest consumer iPhones/iPads, it is now possible to reconstruct indoor environments in 3D, with full 360-degree view synthesis, using enhanced <em>on-device processing</em>. What that means for us is enhanced communication — instead of the cramped, claustrophobic feeling of trying to convey a complex industrial apparatus through a mere iPhone camera, remote experts and end-users can seamlessly collaborate over a shared immersive space in full 3D, reconstructed on the fly on their phone.</li></ol><p><em>Note: if folks would like to learn more about the “Pop-Up Metaverse” concept, please see this </em><a href="https://www.ptc.com/en/blogs/corporate/what-is-industrial-metaverse"><em>article</em></a><em> by Shiva Kashalkar, our VP of Product Management for the Industrial Metaverse.</em></p><h4>Competitive Landscape</h4><p>Perhaps you still don’t believe that the Industrial Metaverse is anything special. To motivate this term, let’s elaborate on the comparison between the kinds of service solutions we’ve relied upon in the past: physical, in-person-based support; and remote service provided over digital technologies.</p><p>When it comes to providing service for industrial products, companies have had to make difficult tradeoffs for<em> </em>decades — do we wish to provide the most<em> accurate/hands-on support</em> to our customers, or the <em>most convenient/easily consumable</em>?</p><p>Servicing physical products, in theory, might seem like a straightforward process:</p><ol><li>You sell a product</li><li>Your customer (inevitably) calls in with a problem</li><li>You send a service technician over to fix the problem</li></ol><p>In this scenario, we trust the technician — or some other kind of subject matter expert (abbreviated “SME”) to save the day. If they know their stuff and can solve the problem with our product hands-on, or at least accurately troubleshoot the cause of the issue, that helps us honor service-level agreements (SLAs) and ultimately maintain strong customer relationships.</p><p>But, what’s the problem with hands-on expert service?</p><p>Imagine this:</p><ul><li>let’s say you’re running a company like Raytheon; and one of your core businesses is to sell <strong>missiles</strong> and other defense equipment to the US military</li><li>i.e., you have LOTS of warfighter customers relying on your product who are deployed thousands of miles away, yet still need you to provide critical support FAST when something goes wrong.</li></ul><p>Enter remote service — with tools like Scope AR, Vuforia Chalk, or perhaps even a regular ‘ol Zoom meeting — you find yourself attempting to deliver the same kind of service to your customers remotely, for the convenience of <em>not</em> having to get on the next fastest plane, every time there’s a problem.</p><p>Nonetheless these tools are not without their problems: as it turns out while it might be convenient to hop on a remote call, it is <em>not </em>always convenient to have to collect supporting 3D assets (i.e., let’s go back to the example of having access to a CAD model handy for that meeting, or parts information from a PLM system). Secondly, if your end user’s mobile hardware is not powerful enough/has only limited networking, it can severely degrade the quality of communication between the customer and your technician.</p><p>Between these two options — in-person service vs. remote service calls — we can see some of the problems that modern industrial face. But the interest in remote service may not be lost for good.</p><h3>Section 2: Brainstorming Solutions</h3><p>Briefly, let’s recall the 2 trends in remote service I mentioned in the previous section:</p><ol><li><strong>Web-Based Integrations Between SaaS Solutions</strong></li><li><strong>On-Device ML</strong> <strong>on the Rise</strong></li></ol><p>Let’s face it — it’s probably not clear at first how these two pieces “fit” together in an actual software solution for service. Or, that’s at least how I felt as a <a href="https://www.ptc.com/en/careers/leadership-development-programs">rotational analyst</a> at PTC, when I began a software engineering role in the Office of the CTO (aka “OCTO”) near the start of January this year.</p><p>For context, PTC’s OCTO houses several teams that have spent the past 5+ years developing core technologies needed for spatial computing. Let’s tackle two in particular, which nicely map to the trends above.</p><p><strong>The Reality Lab (Maps to “On-Device ML</strong> <strong>on the Rise”)</strong></p><p>In the OCTO we have the Reality Lab, driven by Valentin Heun’s vision to leverage “spatial context” in everyday processes, which has developed world reknown breakthrough in areas like spatial programming, robotics, and more (e.g., see the <a href="https://spatialtoolbox.vuforia.com/">Vuforia Spatial Toolbox</a>).</p><p><em>And now you ask: so what?</em> In addition, this group is keenly interested in using <strong>3D reconstruction techniques</strong> for the purpose of generating immersive spaces<em> such as</em> industrial environments. What’s special about their work is that they’re lowering the barrier to entry closer and closer to <strong>consumer-level hardware. </strong>Having worked with <a href="https://www.ptc.com/en/about/reality-lab/team/valentin-heun">Valentin</a> and following his work and class on the Metaverse <a href="https://metaverse.media.mit.edu/">online</a> (and on <a href="https://www.youtube.com/watch?v=QEtnI_Bfs8c&amp;list=UULFvjOHgLecYcXgkqjsIY0MWw&amp;index=16">YouTube</a>), I’ve come to observe that their technology used to require installing large, expensive depth cameras all throughout an indoor space for a given reconstruction (as you can see in this <a href="https://youtu.be/V9zfcmBnbpA?t=1470">demo</a> from 3 years ago). Now, suffice to say we can do this reconstruction all <strong>on-device</strong>, given merely the depth cameras found in the latest iPhone/iPad Pros.</p><p><strong>Advanced Atlas Services (Maps to</strong> “<strong>Web-Based Integrations Between SaaS Solutions”)</strong></p><p>What about that software engineering role I mentioned? It’s not in the Reality Lab — instead, I work on a different OCTO team that builds integrations between our company’s various solutions: the <em>Advanced Atlas Services </em>(AdAS). As you may guess, those integrations include those being developed for the Industrial Metaverse…</p><p><em>And now you ask: so what?</em> At a high-level, our team exists so that when end-users get their hands on PTC’s Metaverse solutions, it <em>won’t </em>be limiting their access to information found in other systems throughout their enterprise, be it CAD, PLM, IoT, etc. That’s because my team works cross-functionally, enabling developers in teams like the Reality Lab to seamlessly access data across <em>all </em>of PTC’s products (which together can be referred to as the “Digital Thread”). TL;DR, no more information silos!</p><h3>Section 3: Product Development <strong>Deep-Dive</strong></h3><p>When Valentin’s group at PTC (namely, <a href="https://www.linkedin.com/in/benolds/">Ben</a> and <a href="https://www.linkedin.com/in/ktheodosiou/">Keranie</a>) first approached our AdAS team, the most immediate use case they wanted our support on was a feature called <strong>Spatial Search. </strong>In a sentence,<strong> </strong>it is a lightweight <strong>search engine, which allows frontline employees to effortlessly lookup information</strong> on a given industrial machine — sourced from <em>whatever</em> software systems are available throughout their enterprise — all within a single UI!</p><h4><strong>User Journey: Remote Service, Inside in the Industrial Metaverse</strong></h4><p>To give a fuller illustration, let’s consider how your process for delivering product support changes with Spatial Search:</p><ol><li>You sell a product</li><li>Your customer (inevitably) calls in with a problem</li><li><em>Before </em>you decide to send (or in some cases, fly) a technician over to the customer site, they whip out their smartphone, scan the relevant environment around the machine, and create a “Pop-Up Metaverse” on the spot.</li><li>Now it’s time for our frontline worker and SME to hop on a shared call. But <em>instead </em>of the two of time wasting time just to conjure up a shared <em>mental</em> model of the 3D space, they now have a shared 3D <em>computer-generated</em> model to view on their devices (most likely a desktop for the SME, and a mobile phone/tablet for the frontline personnel).</li><li>Then, the task for the SME is to merely select spots of interest in that Pop-Up Metaverse environment, and decorate them with content retrieved from systems along their enterprise’s SoRs.</li><li>This is where Spatial Search enters: simply put, one of our users (can be the SME or frontline person) opens a dialog box to select what info should be associated with the spot. They are presented with a search field and enter something like the model name of the product they want to look up. Then, they are presented with a list of information assets associated with that search term (e.g., a parts catalog from Windchill, a popular PLM system). They can navigate the “search results” and select certain assets to be associated with that spot, close to or exactly at the point where the field worker would find it the most useful.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mOH5uMOnRQiokhPDNrrfVA.png" /><figcaption>Special thanks to Valentin for sharing this UI mockup, and Marc-Thomas Schmidt</figcaption></figure><h4>Demo Time!</h4><p>Want to see what Spatial Search looks like in action? Take a look here, PTC’s CEO Jim Heppelmann mentioned as part of his keynote at LiveWorx 23 (starts around 1:32 below):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fmi-rBXrMzBQ%3Fstart%3D92%26feature%3Doembed%26start%3D92&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dmi-rBXrMzBQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fmi-rBXrMzBQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/445f7c8cd2a57b1a295121f5269011c7/href">https://medium.com/media/445f7c8cd2a57b1a295121f5269011c7/href</a></iframe><p>Although Spatial Search is only shown briefly during the keynote, the demo showcases achievements across the full stack:</p><ul><li>on the <strong>front-end</strong>, the IMV team developed new, 2D UI component “markers” to mark the spots in the 3D environment which are associated with assets from outside SoRs,</li><li>and on the<strong> back-end</strong>, our AdAS team provided an API gateway to several Digital Thread SoRs, while only needing to add one more REST service and no additional authorization dialogs to the Spatial Search UI</li></ul><h3>Conclusion</h3><p>So there you have it! To say the least, I am excited for the future of remote service —by utilizing features like Spatial Search, it’s possible to allow the Digital Thread to fade into background, and let companies streamline the service process by crafting AR experiences that are tailored to the information found within their own SoRs.</p><p><em>Feedback time: what did you think of this post? Please share thoughts/questions. And, I’m open to any suggestions on what </em>else<em> you’d like to hear about API development at PTC, or the Industrial Metaverse —let’s build this future together!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14f64b032488" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build Your Own 3D CAD Model Viewer (for the Web)!]]></title>
            <link>https://zain-raza.medium.com/how-to-build-your-own-3d-cad-model-viewer-for-the-web-b1fe65369b35?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1fe65369b35</guid>
            <category><![CDATA[bootstrap]]></category>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[onshape]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Sun, 25 Dec 2022 14:40:52 GMT</pubDate>
            <atom:updated>2023-01-31T11:33:08.047Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Beginner-First Introduction to Integrating Three.js with the Onshape REST API</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QXoot4PJcF63d1Ud" /><figcaption>Photo by <a href="https://unsplash.com/@ffstop?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Fotis Fotopoulos</a> on <a href="https://unsplash.com/s/photos/code?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Demo — here is what we’re building today:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FiAqwPTDNnys%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DiAqwPTDNnys&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FiAqwPTDNnys%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e61bde81d47f91ae92923e8db25f834/href">https://medium.com/media/1e61bde81d47f91ae92923e8db25f834/href</a></iframe><h4>Table of Contents</h4><ol><li><a href="#482a">How to Build for the Web?</a></li><li><a href="#33fc">Tutorial: A Landing Page for a Trucking Company</a></li></ol><ul><li><a href="#3ea1">Step 0: Environment Setup</a></li><li><a href="#5d67">Step 1: Add Boilerplate Code</a></li><li><a href="#9cc8">Step 2: Adding Vaporware Functionality</a></li><li><a href="#ece4">Step 3: Rendering glTFs from the Onshape REST API</a></li></ul><p>3. <a href="http://02a1/">Conclusion</a></p><ul><li><a href="#8af7">So, Why Do We Build for the Web?</a></li></ul><p>4. <a href="#d5ba">Additional Resources</a></p><h3>How to Build for the Web?</h3><p>If you’re a software engineer who’s new to working with Onshape’s REST API for your own web apps, it can be <strong>quite</strong> overwhelming to get started learning how to do so.</p><p>That’s why I wrote this blog for you — as a software engineer currently inside Onshape, my objective is to demystify our API (as well as the stages of full-stack development in general) for you. <strong>By the end of this blog, you will better understand how to:</strong></p><ol><li>Setup Your Local Environment for Web Dev (<em>using</em> <em>VS Code</em>)</li><li>Create a Boilerplate Landing Page (<em>using HTML/CSS)</em></li><li>Create a<strong> glTF Viewer</strong> on a Local Backend (<em>using Three.js/Express.js</em>)</li><li><strong>Request</strong>, <strong>Receive</strong>, and <strong>Render</strong> a glTF Model from your Onshape account (<em>using our REST API</em>)</li></ol><p>With that said — let’s get started!</p><h3>Tutorial: A Landing Page for a Trucking Company</h3><p>For the sake of simplicity, our example will be to build a landing page that incorporates a <strong>3D model viewer —</strong>although it will be pretty barebones, the steps you’ll learn should help in building other kinds of web apps as well.</p><h4>Step 0: Environment Setup</h4><p>If this your first time using git or Express.js, there’s a few tools I need you to setup first:</p><p><strong>1) </strong><a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"><strong>Git</strong></a><strong>: </strong>Download and install this version control tool. See this <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git">page</a> to see how to do so for your particular operating system.</p><p><strong>2)</strong> <a href="https://github.com/"><strong>GitHub</strong></a><strong>: </strong>login<strong>/</strong>sign up for an account now, since we’ll be using that to help you practice pushing/pulling your changes.</p><p>4) Download and install Node.js and the Node Package Manager (<strong>npm</strong>). The preferred way to do this is by first installing something called the Node <em>Version </em>Manager (<strong>nvm</strong>). Let’s do that now:</p><ul><li><em>If you’re on macOS or Linux </em>— I’ll take you directly to the <a href="https://github.com/nvm-sh/nvm#installing-and-updating">GitHub repo</a> for this tool. Open up a Terminal on your system, and paste the following command:</li></ul><pre>$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash</pre><ul><li>This in effect will download nvm for you. Now, use this command to activate it:</li></ul><pre>$ export NVM_DIR=&quot;$([ -z &quot;${XDG_CONFIG_HOME-}&quot; ] &amp;&amp; printf %s &quot;${HOME}/.nvm&quot; || printf %s &quot;${XDG_CONFIG_HOME}/nvm&quot;)&quot;<br>[ -s &quot;$NVM_DIR/nvm.sh&quot; ] &amp;&amp; \. &quot;$NVM_DIR/nvm.sh&quot; # This loads nvm</pre><ul><li>Once that is run, we should verify it actually installed. Run the following command — if it doesn’t break, then you’re good to go:</li></ul><pre>$ nvm --version # should output a version number, e.g. &quot;0.38.0&quot;</pre><ul><li>OK! Now, we can use nvm to quickly install and use different versions of Node.js and npm via the command line. For this tutorial, we’ll go with version 14 of Node, and whatever the latest (compatible) version of npm there is:</li></ul><pre>$ nvm install 14<br>$ nvm use 14 --lts<br>$ nvm install-latest-npm</pre><ul><li>Lastly, before continuing you should go ahead and verify that bothnpm -v and node -v commands execute normally in your Terminal. The output should be a string in the form x.y.z (just like for nvm -v). This will let us know that everything’s working so far.</li><li><em>But Zain, what if I’m on Windows? — </em>I gotchu! There is just 1 minor difference for you compared to the macOS/Linux crowd: you are going to use the <a href="https://github.com/coreybutler/nvm-windows">nvm-windows</a> package on GitHub, instead of plain ‘ol nvm. Use the <a href="https://github.com/coreybutler/nvm/releases">installer</a> linked from that repo to get nvm on your machine, instead of using the Terminal commands above.</li><li>But then afterwards, you should then still be able to run the same commands to get the LTS versions of Node.js and npm.</li></ul><p><strong>5) VS Code: </strong>For this tutorial, you are more than welcome to use any IDE. For those who have not used one before though, I would strongly recommend installing <a href="https://code.visualstudio.com/">Visual Studio Code (aka “VS Code”)</a>, as it offers lots of extensions to make web development easier (especially for beginners).</p><p><strong>6) Note</strong>: if you do indeed choose to use VS Code for this tutorial, my next suggestion would be to install the “Live Server Extension”. To do so, open VS Code, go to Preferences &gt; Extensions, and then simply search for it in the search box. This <a href="https://code.visualstudio.com/learn/get-started/extensions">video</a> by Sana Ajani at Microsoft can provide more background if you’re interested.</p><h4>Step 1: Add Boilerplate Code</h4><p>Now that we’ve finished setup, it’s time to start our web app by building a what every product needs: a sleek-looking landing page!</p><ol><li><strong>Head over to the GitHub repo now. </strong>Please <a href="https://github.com/sraza-onshape/OnshapeExperiments/tree/main#installation">use this link</a> to go directly to the instructions in the README.md. Complete steps 1–4 in that file right now, so you’ll be ready for development.</li><li>So you have the repo now? Great! We’ve divided up the different pieces of this tutorial across several git branches, so you won’t have to worry about keeping track of too many moving parts at once. For now, let’s go to the branch for just <em>this </em>part of the tutorial. Run these commands:</li></ol><pre>$ cd my-OnshapeExperiments.git<br>$ git checkout boilerplate-starter</pre><p>This is a particularly good time to <strong>open the project in your IDE</strong>. If you’re using VS Code, this can also be done from the command line:</p><pre>$ code .  # the &quot;.&quot; is a file path, it should point to wherever the project root directory is located</pre><p>Good stuff! Inside of VS Code, we can verify we all the files we need for right now. If you look over at the File Explorer on the left-hand pane, please verify it looks something like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*vboOEoE7nsAs7PubddI8uw.png" /></figure><p>A few observations to make here:</p><ul><li>README.md — you’ve seen this already.</li><li>.eslintrc.json, .gitignore, package.json, package-lock.json, .env — you can simply ignore these for now.</li><li>standalone/ — this is what we’ll focus on! As you can see, there are 3 subdirectories under here named css , html, and static .</li><li>And so far, there shouldn’t be any files under standalone , except for the .jpg image I’ve provided for you in the static folder (we’ll see how to make use of it later in this section).</li></ul><p>3. Switched branches successfully? Nice. Now, it’s time for us to start building out our landing page!</p><ul><li><strong>The first step is adding a new HTML page.</strong> Let’s do that by first opening a terminal inside of VS Code. Use <em>Ctrl + ` (backtick) </em>or <em>Control + ` </em>to show the integrated terminal (the former is for Windows, the latter for macOS/Linux).</li><li>Then, go ahead and add the new HTML file under the html folder. Using the touch command, let’s name it index.html.</li></ul><pre>$ touch ./standalone/html/index.html  # exact file path will vary based on your local setup</pre><ul><li>So far so good? Once you have that file, open it in the editor. You can either click on its name in the File Explorer, or invoke the same code command from before: code ./standalone/html/index.html.</li><li>Next, inside of index.html , <strong>add the following markdown</strong>:</li></ul><pre>&lt;h1&gt;Hello World&lt;/h1&gt;</pre><p>4. Nice. Now before making any further changes, let’s take a look at what that web app looks like locally. It’s time to run our web server!</p><ul><li>For those of you who have opt-ed to use the “Live Server Extension”, you should be to do this step by doing the following:</li><li>Hover your mouse over the index.html file, on the left hand pane of VS Code.</li><li>Right click on the file. You should then see a menu appear, with an option that says “Open with Live Server”. For example (on macOS):</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*3epv1613UYvLeR8who9gnw.png" /></figure><ul><li>Click on that button! It should then take you to the browser. If everything is working correctly, you should see a page like this on <a href="http://127.0.0.1:5500/standalone/html/index.html">http://127.0.0.1:5500/standalone/html/index.html</a>:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*IV3jh9DeHo7oe1UK0hRh4Q.png" /></figure><ul><li>You should see the text “Hello World” rendered in your browser. Nice work!</li><li>Do you think it’s magic? Let’s prove that it’s not: go back to index.html, and change “Hello World” to “Launch Page”. Save the change using command + s (or Ctrl + s), then go back to your browser. What’s different about the page now?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*zl4Np-KNbeiYghpKT0yeiQ.png" /></figure><ul><li>Alrighty — now we’ll take the next step, and build this into a <em>real </em>launch page. At this point, add the following comments to index.html — it should look like the following:</li></ul><pre>&lt;!-- NAVBAR --&gt;<br><br><br>&lt;!-- HERO --&gt;<br><br>&lt;h1&gt;Launch Page&lt;/h1&gt;<br><br>&lt;!-- CALL TO ACTION --&gt;<br><br><br>&lt;!-- FOOTER --&gt;</pre><ul><li>You may not understand what all these components are yet, and that’s ok. For now, these comments to just to at least give us an outline, or a plan to follow, for the rest of this section.</li><li><strong>Pro-Tip: </strong>it is almost time to start building out your HTML page. To accelerate writing this code though, I would first highly recommend installing a plug-in called <a href="https://www.emmet.io/"><strong>Emmet</strong></a>, which expands your IDE’s auto-completion capabilities (so you can write code faster!). If you’re using VS Code, Emmet will work for you right out of the box. If you’re not, I suggest checking out the <a href="https://www.emmet.io/download/">Download</a> page on Emmet’s documentation to see how to get it for your particular text editor.</li><li>Now that you have Emmet installed, you can rapidly write HTML by typing the HTML tag and hitting thetab key. Try out these to practice:</li></ul><pre>h1 =&gt; &lt;h1&gt;&lt;/h1&gt;<br>p =&gt; &lt;p&gt;&lt;/p&gt;</pre><ul><li>You can create tags that include CSS class and id names using the . and the # symbols, respectively:</li></ul><pre>p.lead =&gt; &lt;p class=&quot;lead&quot;&gt;&lt;/p&gt;<br>.jumbotron =&gt; &lt;div class=&quot;jumbotron&quot;&gt;&lt;/div&gt;<br>li.card =&gt; &lt;li class=&quot;card&quot;&gt;&lt;/li&gt;<br><br>ul#comments =&gt; &lt;ul id=&quot;comments&quot;&gt;&lt;/ul&gt;</pre><p>5. Once you feel comfortable navigating the codebase, let’s come back to adding HTML boilerplate for our app!</p><ul><li>Boilerplate is any standard code that is always there. Emmet gives us HTML boilerplate by typing html:5, and hitting tab.</li><li>Go ahead and do that — then, move our comments from earlier into the &lt;body&gt;&lt;/body&gt; tag. Afterwards, your index.html should look like this:</li></ul><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Document&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;!-- NAVBAR --&gt;<br><br>    &lt;!-- HERO --&gt;<br><br>    &lt;h1&gt;Launch Page&lt;/h1&gt;<br><br>    &lt;!-- CALL TO ACTION --&gt;<br><br>    &lt;!-- FOOTER --&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><blockquote>ALERT: Watch out for <em>indentation! </em>It is important to always keep everything properly indented. The HTML will work if the indentation is bad, but it will be <em>much </em>more difficult for you to spot bugs and problems. So always keep your indentation consistent.</blockquote><p>6. OK! We have started our HTML — but what about our CSS? Although we could style this entire website ourselves using our own CSS, I’d prefer to show you how to do what almost <em>everyone</em> does instead, from the smallest consultant to the largest companies: <strong>use a CSS Framework!</strong></p><ul><li>In this case, we’ll be using one of the most popular CSS frameworks on the web,<strong> Bootstrap 5</strong>.</li><li>To begin, watch this <a href="https://www.youtube.com/watch?v=eow125xV5-c">20 minute demo</a> of Bootstrap. It will give you a visual sense of the framework, how to use it, and the code behind it. You’ll have a much easier time making progress after digesting this mental model (and if you get stuck at any point after, be sure to keep the <a href="https://getbootstrap.com/docs/5.0/getting-started/introduction/">Bootstrap documentation</a> close by).</li><li>Now then — there are a few ways to add Bootstrap 5 to our project, but we’re going to use the easiest. We can simply add a link to the Bootstrap 5 (both its CSS and JavaScript) in our &lt;head&gt;&lt;/head&gt;,tag like this:</li></ul><pre>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;!-- Load in Bootstrap 5 CSS --&gt;<br>    &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl&quot; crossorigin=&quot;anonymous&quot;&gt;<br><br>    &lt;title&gt;Document&lt;/title&gt;<br>&lt;/head&gt;</pre><ul><li>We can tell that Bootstrap is added if you save. The font of our h1 should have changed to look more, well, <em>Bootstrap-py</em>:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*CPPQ7nxaP7fIODgwbMRWTg.png" /><figcaption>Bootstrap’s default font is a sans-serif typeface.</figcaption></figure><p><em>Note: </em>the rounded look of this font is more formally described as being <em>san-serif </em>(I just made up the word “Bootstrap-py”).</p><p>7. Next let’s set about adding a <strong>navigation bar (</strong>aka a <strong>navbar</strong>) to our site. On a lot of real launch sites, these are super common as they help users stay clued in to where they are and what actions they can take at all times.</p><ul><li>Bootstrap comes with a Navbar component (<a href="https://getbootstrap.com/docs/4.3/components/navbar/">link to docs</a>) to add a navbar to your page. The simplest implementation of the navbar component is this:</li></ul><pre>  &lt;!-- NAVBAR --&gt;<br>  &lt;nav class=&quot;navbar navbar-light bg-light&quot;&gt;<br>    &lt;a class=&quot;navbar-brand&quot; href=&quot;#&quot;&gt;Navbar&lt;/a&gt;<br>  &lt;/nav&gt;</pre><p>This has just two parts, the navbar itself, and then the navbar-brand which is the name of your project.</p><p>While we’re on the subject, let’s now change the text to in the navbar to say something that sounds little closer to an actual company name. Make the following updates:</p><ul><li>Change the text inside the &lt;a&gt; tag to instead say “ACME”.</li><li>And finally — on a related note, we should change the text inside the &lt;title&gt; to be more descriptive. Change that to read “ACME Inc.: 3D Truck Viewer” (more on the 3D viewer will come in Step 2).</li></ul><p>By the end, your index.html should now look like the following:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;!-- Load in Bootstrap 5 CSS --&gt;<br>    &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl&quot; crossorigin=&quot;anonymous&quot;&gt;<br><br>    &lt;title&gt;ACME Inc.: 3D Truck Viewer&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;!-- NAVBAR --&gt;<br>    &lt;nav class=&quot;navbar navbar-light bg-light&quot;&gt;<br>        &lt;a class=&quot;navbar-brand&quot; href=&quot;#&quot;&gt;ACME&lt;/a&gt;<br>    &lt;/nav&gt;<br><br>    &lt;!-- HERO --&gt;<br><br>    &lt;h1&gt;Launch Page&lt;/h1&gt;<br><br>    &lt;!-- CALL TO ACTION --&gt;<br><br>    &lt;!-- FOOTER --&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><ul><li>OK! Now back to the navbar itself. Another improvement is to make this component more accessible to users with smaller screen sizes. One of the ways we can do this with Bootstrap is by adding a “toggle” button, and use CSS so that it automatically collapses the navbar when the browser window is not wide enough. Take a look at the next code snippet, where I’ve added this &lt;button&gt; (along with a few aria attributes, which are also there for accessibility purposes):</li></ul><pre>&lt;!-- NAVBAR --&gt;<br>&lt;nav class=&quot;navbar navbar-light navbar-expand-md bg-light&quot;&gt;<br>    &lt;div class=&quot;row&quot;&gt;<br>        &lt;a class=&quot;navbar-brand w-50 mr-auto&quot; href=&quot;/&quot;&gt;<br>            &lt;p&gt;ACME&lt;/p&gt;<br>        &lt;/a&gt;<br>        &lt;button class=&quot;navbar-toggler&quot;<br>                type=&quot;button&quot;<br>                data-toggle=&quot;collapse&quot;<br>                data-target=&quot;#navbarContent&quot;<br>                aria-controls=&quot;navbarContent&quot;<br>                aria-expanded=&quot;false&quot;<br>                aria-label=&quot;Toggle navigation&quot;&gt;<br>            &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>        &lt;/button&gt;<br>        &lt;div class=&quot;collapse navbar-collapse justify-content-end&quot; id=&quot;navbarContent&quot;&gt;<br>            &lt;ul class=&quot;list-group list-group-horizontal ml-auto&quot;&gt;<br>            &lt;/ul&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/nav&gt; </pre><ul><li>Note: if we had other pages to this site, we could add links to those other pages by inserting &lt;li&gt; elements within the &lt;ul&gt; tag above. Just so you know :)</li><li>Ok, so now your page should look like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*eDx74OcnBik1BPcnH29uzQ.png" /></figure><ul><li>That navbar looks OK so far — but, do you notice how cramped the brandmark “ACME” looks? What can we do to improve its spacing on the left side? Answer: custom CSS!</li><li>At this point, let’s go back to the &lt;a&gt; tag that contains the “ACME” text, inside of index.html. Our goal is to move it slightly to the right. We only want to apply styling to that text itself — so, let’s go ahead and nest the text inside of a &lt;p&gt; element, inside the &lt;a&gt; element. Finally, give it an id attribute, and name it &quot;custom-home-link&quot;. Your index.html should now contain this:</li></ul><pre>&lt;!-- NAVBAR --&gt;<br>...<br>&lt;a class=&quot;navbar-brand w-50 mr-auto&quot; href=&quot;/&quot;&gt;<br>    &lt;p id=&quot;custom-home-link&quot;&gt;ACME&lt;/p&gt;<br>&lt;/a&gt;<br>...</pre><ul><li>Now we have a way to apply CSS to the text, but we haven’t created the CSS styles yet. Change that by going back to the terminal, and creating a new CSS file (call it styles.css) inside of the css/ folder:</li></ul><pre>$ touch standalone/css/styles.css</pre><ul><li>Open that file in your editor. To fix the left margin of our brand mark, we can use the margin-left property. Add the following to styles.css</li></ul><pre>#custom-home-link {<br>    margin-left: 1rem;<br>}</pre><ul><li>Now, to apply this to our HTML, the very last step is to nest a link tag in the &lt;head&gt; element on our page. Go back to index.html, and link our CSS file from there:</li></ul><pre>&lt;head&gt;<br>    &lt;!-- Load in Bootstrap 5 CSS --&gt;<br>    ... <br>    &lt;!-- Custom CSS --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;../css/styles.css&quot; type=&quot;text/css&quot;&gt;<br>    ...<br>&lt;/head&gt;</pre><ul><li>Note: your custom CSS should always go below where you link Bootstrap! Otherwise, Bootstrap’s own CSS will override your classes.</li><li>Save all your changes. Go back to the browser, see the magic:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*nVnmCoqn7dLpmFhZLHdH8Q.png" /></figure><ul><li>Cowabunga!</li></ul><p>8. After the navbar, let’s focus on adding a “<strong>Hero</strong>” section of our website. The Hero is usually a splashy image and text of the product to give new visitors to our site a good feeling about what our company does.</p><ul><li>Let’s start this process by first adding a container to hold our Hero (this will automatically take care of some of the minor aspects of good design, like margins). Under the &lt;!-- HERO --&gt; comment in our code, nest the existing &lt;h1&gt; in a div with the utility class &quot;container&quot;:</li></ul><pre>&lt;!-- HERO --&gt;<br>&lt;div class=&quot;container&quot;&gt;<br>    &lt;h1&gt;Launch Page&lt;/h1&gt;<br>&lt;/div&gt;</pre><ul><li>Now, to actually make a nice Hero in Bootstrap, we use the jumbotron component. Observe the next snippet (this is more boilerplate code):</li></ul><pre>&lt;!-- HERO --&gt;<br>&lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;jumbotron&quot;&gt;<br>        &lt;h1&gt;Launch Page&lt;/h1&gt;<br>        &lt;p class=&quot;lead&quot;&gt;A Fantastic Product!&lt;/p&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>Your page should now look like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6evL7l_Qre7ksxGyyzn7JQ.png" /></figure><ul><li>Good work so far! Before moving on, I think we can update that text to be a little more spirited than just “Launch Page”. Go ahead and change the h1 text in your HTML file to instead say “Command the Road”. Underneath it, you can also ahead and change the text in the &lt;p&gt;tag to say “Your new truck awaits.”, so that it matches the example site shown in the video above. Your code should look like this:</li></ul><pre>&lt;!-- HERO --&gt;<br>&lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;jumbotron&quot;&gt;<br>        &lt;h1&gt;Command the Road&lt;/h1&gt;<br>        &lt;p class=&quot;lead&quot;&gt;Your new truck awaits.&lt;/p&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>If you take a look at the browser now, it should look something like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAlY_-UZ3YLYw67kDh3EAw.png" /></figure><ul><li>To make the header stand out even more, we can use the display utility class. Go ahead and see the next code snippet (I’ve also incorporated more rowclasses, so we’re utilizing Bootstrap’s default grid system):</li></ul><pre>&lt;!-- HERO --&gt;<br>&lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;jumbotron&quot;&gt;<br>        &lt;h1 class=&quot;row display-3&quot;&gt;Command the Road&lt;/h1&gt;<br>        &lt;div class=&quot;row&quot;&gt;<br>            &lt;p class=&quot;ml-3 lead&quot;&gt;Your new truck awaits.&lt;/p&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>Finally — in preparation for the next sections we’ll add to this page, add a hr element to the bottom of the jumbotron div. Your code should look like this:</li></ul><pre>&lt;!-- HERO --&gt;<br>&lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;jumbotron&quot;&gt;<br>        &lt;h1 class=&quot;row display-3&quot;&gt;Command the Road&lt;/h1&gt;<br>        &lt;div class=&quot;row&quot;&gt;<br>            &lt;p class=&quot;ml-3 lead&quot;&gt;Your new truck awaits.&lt;/p&gt;<br>        &lt;/div&gt;<br>        &lt;hr class=&quot;my-2&quot;&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>Now double check your browser looks something like the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hKgUTXj8SD8uQofbSLdUw.png" /></figure><p>9. Coming together eh? Here’s what would make this even better: a <strong>background image!</strong></p><ul><li><a href="https://unsplash.com/">Unsplash</a> is a great place to find some free photographs to spruce up our page. Since this is a page about trucks, you can see in the starter repo that I left one image can use. The path is “standalone/static/seb-creativo-3jG-UM8IZ40-unsplash.jpg”.</li><li>We want our background image to be for the whole page. So, let’s first nest everything under the &lt;body&gt;tag under a new div element, with an id of “truck-bg”. Your index.htmlshould look like this:</li></ul><pre>&lt;body&gt;<br>    &lt;div class=&quot;truck-bg&quot;&gt;<br>        &lt;!-- NAVBAR --&gt;<br>        ...<br><br>        &lt;!-- HERO --&gt;<br>        ...<br><br>        &lt;!-- CALL TO ACTION --&gt;<br><br>        &lt;!-- FOOTER --&gt;<br><br>    &lt;/div&gt;<br>&lt;/body&gt;</pre><ul><li>Now that we’ve added the truck-bg to your HTML, and now define that class in your CSS. See the following code snippet:</li></ul><pre>/* styles.css */<br><br>#custom-home-link {...}<br><br>/* The ruleset below is adapted from Chris Coyier&#39;s post on the following: https://css-tricks.com/perfect-full-page-background-image/ */<br>#truck-bg {<br>    background: url(https://medium.com/&quot;../static/seb-creativo-3jG-UM8IZ40-unsplash.jpg&quot;) no-repeat center center fixed; <br>    -webkit-background-size: cover;<br>    -moz-background-size: cover;<br>    -o-background-size: cover;<br>    background-size: cover;<br>}</pre><ul><li>If you save that and go back to your browser, the image will, admittedly, not look that great. It is currently set to cover all of the our page content, which is so far just 1 jumbotron. So it ends up looking like it was cropped vertically:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DZRRpfUcu83B3c9pQd0kAw.png" /></figure><ul><li>Don’t worry about this for now — we’ll fix this as we go along, by adding more elements to the page that increase its vertical length. For now, what we <em>can </em>do is fix the text on our Hero, so it stands out again the dark-colored background. In Bootstrap, there’s a utility class called &quot;text-white&quot; you can use to help you do this. For example, you can do something like the following:</li></ul><pre>&lt;!-- HERO --&gt;<br>&lt;div class=&quot;container text-white&quot;&gt;<br>    &lt;div class=&quot;jumbotron&quot;&gt;<br>        &lt;h1 class=&quot;row display-3&quot;&gt;Command the Road&lt;/h1&gt;<br>        &lt;div class=&quot;row&quot;&gt;<br>            &lt;p class=&quot;ml-3 lead&quot;&gt;Your new truck awaits.&lt;/p&gt;<br>        &lt;/div&gt;<br>        &lt;hr class=&quot;my-2&quot;&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>Then, your page should look similar to this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZI2yyRXozubD3lb61Ce1ww.png" /></figure><p>10. OK! Now that folks have been introduced to our service in the hero, <em>usually</em> the next thing to do is to tell them about the benefits of our product. We’re going to <em>skip </em>that step for the sake of brevity. Instead, we’re going to go straight into asking our users to take an action on the page. This is called a “Call To Action” or CTA. In this case we’ll link to another page, where they can learn more about our truck.</p><ul><li>We’ll use the jumbotron component again. And in order to make our link centered, we&#39;ll use Bootstrap&#39;s handy text-centerclass. See the below code (I’ve also added other attributes, they’re not as important but please read the Bootstrap docs to clarify their function):</li></ul><pre>&lt;!-- CALL TO ACTION --&gt;<br>&lt;div class=&quot;jumbotron text-center mt-5&quot;&gt;<br>    &lt;button type=&quot;button&quot;<br>            class=&quot;btn btn-primary btn-lg&quot;<br>            data-toggle=&quot;button&quot;<br>            data-target=&quot;#ViewerButton&quot;&gt;<br>        &lt;h4&gt;<br>            &lt;a class=&quot;text-white&quot; href=&quot;./viewer.html&quot;&gt;See More&lt;/a&gt;<br>        &lt;/h4&gt;<br>    &lt;/button&gt;<br>&lt;/div&gt;</pre><ul><li>Note: this page we’re linking to,viewer.html, hasn’t been created it yet; but don’t worry — that’s coming up in Step 2 when we’ll build our 3D viewer for the glTF models :)</li><li>Your page should look like the following now:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_LgOkWQMz2hJf3tpTW54Q.png" /></figure><ul><li>Note 2: take a look back up at the &quot;mt-5&quot;class used in the first div in the code above. We use this utility to add a <em>m</em>argin to the <em>t</em>op of our CTA button, so that it’s not sitting flush with the Hero.</li><li>Lastly, if we want to fill this page out a little further, that can be done with a little extra CSS. Add an idto the div containing our CTA, with the value of something like &quot;middle-section”:</li></ul><pre>&lt;!-- Call to Action (CTA) --&gt;<br>&lt;div id=&quot;middle-section&quot; class=&quot;jumbotron text-center mt-5&quot;&gt;<br>    &lt;button type=&quot;button&quot; class=&quot;btn btn-primary btn-lg&quot; data-toggle=&quot;button&quot; data-target=&quot;#ViewerButton&quot;&gt;<br>        &lt;h4&gt;<br>            &lt;a class=&quot;text-white&quot; href=&quot;./viewer.html&quot;&gt;See More&lt;/a&gt;<br>        &lt;/h4&gt;<br>    &lt;/button&gt;<br>&lt;/div&gt;</pre><ul><li>To define this class in your CSS, we can set the heightproperty:</li></ul><pre>/* styles.css */<br><br>...<br><br>#middle-section {<br>    height: 45em;<br>}</pre><ul><li>Save your code, and verify your page looks something like below:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xDcXv-lCs9Y22TUh-DsAw.png" /></figure><p>11. Lastly, we can polish off our page with a footer. Footers can be quite large (in fact, we’re a <a href="https://www.onshape.com/en/">perfect example of this at Onshape</a>), but we are just going to keep it simple for today. Using just a few more utility classes, we can make a nice footer. bg-secondary gives us the secondary background color (dark grey), and p-5 gives the element a large amount of padding on all sides. text-whiteshould also be used here, for the same reasons we used it in the hero.</p><ul><li>Check this out:</li></ul><pre>&lt;!-- FOOTER --&gt;<br>&lt;div class=&quot;mt-5 bg-secondary p-5 text-white&quot;&gt;<br>    &lt;div class=&quot;row&quot;&gt;<br>        &lt;p&gt;&amp;copy 2022 ACME Inc. &lt;br&gt;<br>        &lt;/p&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>Note: that little &amp;copy; is HTML&#39;s way of writing the copyright symbol: ©.</li><li>If you save and scroll to the bottom of the page, you should see something like the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPAJGSme8FPo_WxOmEpY8Q.png" /></figure><ul><li>How about that? It’s good to make footers a dark color because it kind of signals that the page is over. In this case, it also goes well with the color palette of our image.</li><li>Speaking of which —let’s give credit to the photographer of our Unsplash photo. The footer is a great place to give acknowledgements and link to others’ work. Nest a new row under our copyright text — we can put a link to the source of our photo, and put it in a &lt;small&gt;tag to not be too overwhelming:</li></ul><pre>&lt;!-- FOOTER --&gt;<br>&lt;div class=&quot;mt-5 bg-secondary p-5 text-white&quot;&gt;<br>    &lt;div class=&quot;row&quot;&gt;<br>        &lt;p&gt;&amp;copy 2022 ACME Inc. &lt;br&gt;<br>            &lt;div class=&quot;row ml-auto&quot;&gt;<br>                &lt;small&gt;<br>                    &lt;p&gt;<br>                        Photo Credits: &quot;Truck&quot; by &lt;a href=&quot;https://unsplash.com/es/@sebcreativo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText&quot;&gt;Seb Creativo&lt;/a&gt; on &lt;a href=&quot;https://unsplash.com/s/photos/truck?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;<br>                    &lt;/p&gt;<br>                &lt;/small&gt;<br>            &lt;/div&gt;<br>        &lt;/p&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>The new footer should look like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkSU4AHnMUw4SAaK4Wvx2w.png" /></figure><p>If it does, great work! Otherwise go back and troubleshoot until it is pixel perfect.</p><p>12. Now you have the baseline of your Launch Page, but nobody likes something so generic! Let’s spice things up.</p><ul><li>One of the easiest things you can do to add some uniqueness to your page is to use a <strong>Bootstrap Theme</strong>. Some themes are fancy and complex —but for this tutorial, we’re just going to use a free one that augments Bootstrap itself without adding any extra components.</li><li>Navigate to <a href="https://bootswatch.com/">Bootswatch.com</a> — there’s a lot of themes here, which I encourage you to explore on your own at some point. For this tutorial, we’ll make use of the “Darkly” theme.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lcNr54HPWG64_B718Le8w.png" /></figure><ul><li>You can use the URL to link it in your head BELOW where you added Bootstrap itself (but still above your custom CSS). Alternatively, the better approach is to actually download the .min.css file and add it to your project, (I would recommend placing it inside the css/folder). Here’s a screenshot of the button to download the file from Bootswatch:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDBhtWZGURUCZ03igHct8A.png" /></figure><ul><li>In either case, the headcomponent of index.html should now look similar to this:</li></ul><pre>&lt;head&gt;<br>    ...<br>    &lt;!-- Load in Bootstrap 5 CSS/JS --&gt;<br>    &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl&quot; crossorigin=&quot;anonymous&quot;&gt;<br>    &lt;!-- Link in &quot;Darkly&quot; theme --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;../css/bootstrap.min.css&quot; type=&quot;text/css&quot;&gt;<br>    &lt;!-- Custom CSS --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;../css/styles.css&quot; type=&quot;text/css&quot;&gt;<br>    &lt;title&gt;ACME Inc.: 3D Truck Viewer&lt;/title&gt;<br>&lt;/head&gt;</pre><ul><li>Last thing: you’ll probably want to tweek your navbar (and the footer, for good measure) to be navbar-dark and change the background tobg-dark (or play with colors like: bg-primary, bg-secondary , etc). And then don’t forget about the utility class &quot;text-white&quot;to stand out from the dark background color. At the end of this, your page should look something like the following:</li></ul><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>    &lt;head&gt;<br>        &lt;meta charset=&quot;UTF-8&quot;&gt;<br>        &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;<br>        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>        &lt;!-- Load in Bootstrap 5 CSS --&gt;<br>        &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>        &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>        &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl&quot; crossorigin=&quot;anonymous&quot;&gt;<br>        &lt;!-- Link in &quot;Darkly&quot; theme: --&gt;<br>        &lt;link rel=&quot;stylesheet&quot; href=&quot;../css/bootstrap.min.css&quot; type=&quot;text/css&quot;&gt;<br>        &lt;link rel=&quot;stylesheet&quot; href=&quot;../css/styles.css&quot; type=&quot;text/css&quot;&gt;<br>        &lt;title&gt;ACME Inc.: 3D Truck Viewer&lt;/title&gt;<br>    &lt;/head&gt;<br>    &lt;body&gt;<br>        &lt;div id=&quot;truck-bg&quot;&gt;<br>            &lt;!-- TOP NAVBAR --&gt;<br>            &lt;nav class=&quot;navbar navbar-dark navbar-expand-md bg-dark&quot;&gt;<br>                &lt;div class=&quot;row&quot;&gt;<br>                    &lt;a class=&quot;navbar-brand w-50 text-white mr-auto&quot; href=&quot;/&quot;&gt;<br>                        &lt;p id=&quot;custom-home-link&quot;&gt;ACME&lt;/p&gt;<br>                    &lt;/a&gt;<br>                    &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#navbarContent&quot; aria-controls=&quot;navbarContent&quot; aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;<br>                        &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>                    &lt;/button&gt;<br>                    &lt;div class=&quot;collapse navbar-collapse justify-content-end&quot; id=&quot;navbarContent&quot;&gt;<br>                        &lt;ul id=&quot;custom-home-link&quot; class=&quot;list-group list-group-horizontal ml-auto&quot;&gt;<br>                        &lt;/ul&gt;<br>                    &lt;/div&gt;<br>                &lt;/div&gt;<br>            &lt;/nav&gt; <br>        <br>            &lt;!-- HERO --&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;div class=&quot;jumbotron justify-content-center&quot;&gt;<br>                    &lt;h1 class=&quot;row display-3&quot;&gt;Command the Road&lt;/h1&gt;<br>                    &lt;div class=&quot;row&quot;&gt;<br>                        &lt;p class=&quot;ml-3 lead&quot;&gt;Your new truck awaits.&lt;/p&gt;<br>                    &lt;/div&gt;<br>                    &lt;hr class=&quot;my-2&quot;&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br><br>            &lt;!-- Call to Action (CTA) --&gt;<br>            &lt;div id=&quot;middle-section&quot; class=&quot;jumbotron text-center mt-5&quot;&gt;<br>                &lt;button type=&quot;button&quot; class=&quot;btn btn-primary btn-lg&quot; data-toggle=&quot;button&quot; data-target=&quot;#ViewerButton&quot;&gt;<br>                    &lt;h4&gt;<br>                        &lt;a class=&quot;text-white&quot; href=&quot;./viewer.html&quot;&gt;See More&lt;/a&gt;<br>                    &lt;/h4&gt;<br>                &lt;/button&gt;<br>            &lt;/div&gt;<br><br>            &lt;!-- FOOTER --&gt;<br>            &lt;div class=&quot;mt-5 bg-secondary p-5 text-white&quot;&gt;<br>                &lt;div class=&quot;row&quot;&gt;<br>                    &lt;p&gt;&amp;copy 2022 ACME Inc. &lt;br&gt;<br>                        &lt;div class=&quot;row ml-auto&quot;&gt;<br>                            &lt;small&gt;<br>                                &lt;p&gt;<br>                                    Photo Credits: &quot;Truck&quot; by &lt;a href=&quot;https://unsplash.com/es/@sebcreativo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText&quot;&gt;Seb Creativo&lt;/a&gt; on &lt;a href=&quot;https://unsplash.com/s/photos/truck?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;<br>                                &lt;/p&gt;<br>                            &lt;/small&gt;<br>                        &lt;/div&gt;<br>                    &lt;/p&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/body&gt; <br>&lt;/html&gt;</pre><ul><li>And here’s the corresponding browser view. Note that because of the page height, I’ve zoomed out just to fit the page to the screenshot, otherwise it’s OK if your window is not large enough to see the footer at the bottom:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dFXN4sG8t4hKo0fudgt3mA.png" /></figure><p>You now have a launch page. Before moving to the next section of this tutorial, make a git commit to mark your progress:</p><pre>$ git add .<br>$ git commit -am &quot;added boilerplate home page&quot;</pre><p>To compare your work to the solution code on GitHub, we have a branch for that as well: use git checkout boilerplate-solutionto see it.</p><p>Woohoo — congrats on the great work so far 🥳 !</p><h4>Step 2: Adding Vaporware Functionality</h4><p>In this section, our goal is to create the vaporware. That is to say, we’re going to have a glTF viewer by the end of this section — but instead of dealing with the Onshape REST API just yet, we’re just going to implement the front-end functionality first. This way it should be easier to debug, since you’ll just be using local glTF assets.</p><ol><li>Switch to the starter code for this section to begin:</li></ol><pre>$ git checkout vaporware-starter</pre><p>2. Take a look around the repo — what are some of the changes you notice?</p><ul><li>Specifically, pay close attention the comments in the repo which begin with &quot;[Challenge X]&quot; — these are where I’ll ask you to focus on coding for this section.</li><li>Note: To simulate what goes on in industry, we’ll be implementing our viewer using a popular JavaScript library for 3D web-graphics, known as <a href="https://threejs.org/">Three.js</a><strong>. </strong>It’s a <em>huge</em> library which is more than deserving of its own <a href="https://threejs.org/manual/#en/fundamentals">dedicated tutorial series</a> — but for this blog, I’ve provided a lot more starter code, so it’ll hopefully be more manageable to follow along and you can just focus on the most crucial bits of making the 3D viewer.</li></ul><p>3. One last thing before we resume coding — let’s get a glTF model file you can use locally! Here are your options:</p><ul><li>If you have an Onshape model in particular you would like to be able to visualize, then check out <a href="https://www.onshape.com/en/resource-center/tech-tips/how-to-import-and-export-with-onshape#">Cody’s article</a> on how to export your documents to the glTF format.</li><li>Otherwise, you are free to export a glTF from the sample truck model (shown in the video at the beginning). I’ve enabled link sharing for this model, so you can visit it <a href="https://cad.onshape.com/documents/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/e/12bd0e929396835dadeaa83b?renderMode=0&amp;uiState=63a31dd4d424ee57015f34dc">here</a> (credit goes to Poojan Shah for originally creating this truck in this public Onshape document over <a href="https://cad.onshape.com/documents/79f4e7fd3dfb0fbaaf718720/w/6e4c68c77fed61d89d6ea1da/e/ad7e07baec70159421a3692c"><em>here</em></a>)!</li><li>Once you are on the document, it should look something like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5J2gUcNXZ13hY25hnpWouA.png" /></figure><ul><li>To export a glTF, start by clicking the arrow next to the download icon on the page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*Jj9VEfeoM6FHKsnFiZoFNQ.png" /></figure><ul><li>In the menu that shows up, you’ll want to select “Export tab…”.</li><li>Now, there should be a modal on the screen titled “Export”. There are a lot of fields in this form, but don’t worry — the only one you really need to worry about is the “Format”. Open that dropdown, and make sure to select the “GLTF” option. See below for a screenshot of what this looks like:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VytZ67NPAHKdgP-dMB0LkA.png" /></figure><ul><li>Once you have made that selection, go ahead and click the blue “Export” button in the modal. Your glTF file should download in a few moments!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*TVwBIvcQpRsicoJUxq-mWQ.png" /></figure><ul><li><strong>Last thing</strong>: once you have your new glTF (probably named “blueTruck.gltf”), make sure to move it to the static/ folder in our project repo (so it’ll make future instructions easier to follow).</li></ul><p>4. Alrighty, so this is probably the part where you’re thinking, “<em>Zain, cool glTF — but how do I render it on the web page?</em>”</p><ul><li>Easy. We will be focusing on how to do so in <strong>Challenge 1 </strong>of this section. Flip over to the starter code for index.js on this branch, and search for the string Challlenge 1 in the file. It should look like this:</li></ul><pre>// (3) setup for loading glTF based on user selection<br>activateBtn.addEventListener(&#39;click&#39;, async (evt) =&gt; {<br>    // retrieve form values + access the glTF<br>    try {<br>        document.body.style.cursor = &#39;progress&#39;;        <br>        /** [Challenge 1]: Displaying Our Local glTF File<br>         * In order for this work, you must call loadGltf(),<br>         * passing the relative file path to your specific .glb/.gltf file.<br>         * <br>         * Hint: please make sure to read the function body of loadGltf() <br>         * above, in case you have any doubts!<br>         */<br>        /** your code goes here */<br><br>    } catch (err) {<br>        displayError(`Error in displaying glTF: ${err}`);<br>    }<br>});</pre><ul><li>So, what is this saying? We can see above that what I’m asking you to do is fill in part of an event listener for a button, <em>somewhere</em>, on the viewer page. But, where is said button? In fact, what <em>is </em>the viewer page?</li><li>To give some context here, go back to your browser, and visit the home page for our website. Remember that CTA button from before? Click on it! (<em>or, if you’re using the Live Server Extension, feel free to just go to </em><a href="http://127.0.0.1:5500/standalone/html/viewer.html"><em>http://127.0.0.1:5500/standalone/html/viewer.html</em></a><em>).</em></li><li>Once you’re there — tada! <em>This </em>is what I meant by the viewer page. It should look something like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mfy9XK7RQ6cIG-A-Ifxc5A.png" /></figure><ul><li>Feel free to go look deeper into viewer.htmlif you’re curious to know more about how this page is marked up in HTML (it’s mostly more of the same as what we did for index.html). For right now though — do you see that blue button that says “Click Me!” on the page?</li><li>(Psst — <em>that </em>is the button our event listener is for!)</li><li>Our intended UX here is for the user to click on that HTML button, so then our JavaScript knows to render our 3D model onto the viewport using Three.js.</li><li>So, how do we solve this challenge? I would encourage you to <strong>pause here</strong>, read more into the code in index.js, and give this a shot on your own before I give the solution below. And don’t be afraid to dive into the <a href="https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene">Three.js documentation</a> if you have questions — exploration is good!</li><li><strong>Solution Time: </strong>ok! As the hint our Challenge 1 comment mentions, the key to solving this piece is invoke the loadGltf()function, passing in the relative file path to your glTF asset. In this case, assuming your asset is named blueTruck.gltfand is stored in the static/ folder, the code would look like this:</li></ul><pre>// ...<br>try {<br>    // ...<br>    loadGltf(&quot;../static/blueTruck.gltf&quot;);<br>}<br>// ...</pre><ul><li>Not convinced? Go back to viewer.html, and test out that “Click Me!” button. You should see your truck load in, like shown below:</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FOsnAGCPafDEgTncjn3%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FOsnAGCPafDEgTncjn3%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FOsnAGCPafDEgTncjn3%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="367" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd72374d73b5a8a203ce248ab4d0291b/href">https://medium.com/media/bd72374d73b5a8a203ce248ab4d0291b/href</a></iframe><ul><li>Note: for more on how Three.js parses glTFs to load 3D graphics, I would definitely recommend reading up on the <a href="https://threejs.org/docs/index.html?q=gltfload#examples/en/loaders/GLTFLoader">GLTFLoader</a> class.</li></ul><p>5. Next up — our viewer is working, but our initial viewpoint at the model is in kind of an awkward, close-up position. Can we use Three.js to fix that?</p><ul><li>Short answer — yes! Let’s see how in Challenge 2of this section. Just like before, start by finding the comment containing the challenge string in index.js. It should look something like this:</li></ul><pre>/**<br> * Sets the contents of the scene to the given GLTF data.<br> * <br> * @param {object} gltfScene The GLTF data to render.<br> */<br>const setGltfContents = (gltfScene) =&gt; {<br>    // ...<br>    /** [Challenge 2]: Fixing the Camera Position<br>     * <br>     * Our viewer is almost complete! We&#39;ve retrieved our glTF,<br>     * and this function contains most of the code you need to<br>     * build a standalone 3D model viewer using Three.js. <br>     * <br>     * BUT, the camera&#39;s position could be improved.<br>     * <br>     * Your task: let&#39;s get that camera positioned so that it looks <br>     * directly at the center of the whatever glTF model we&#39;ve retrieved<br>     * from the API.<br>     * <br>     * a) To start, set the camera position to copy the coordinates in the<br>     *    &quot;center&quot; variable above.<br>     * b) Next, use the size our our &quot;box&quot; variable to set the position<br>     *    of the camera along the X, Y, and Z axes.<br>     */<br>    /** your code goes here */<br>    // ...<br>};</pre><ul><li>Take a moment to read the description in this comment. You’ll notice this is in a function called setGltfContents() , which is called once your gltfLoaderobject (seen earlier in Challenge 1) successfully loads your glTF file. Specifically, we’ll be focusing on how to use Three.js’ “camera” object to adjust the starting viewpoint into our 3D model.</li><li><strong>Pause here, </strong>and please give this challenge a try on your own (feel free to read the docs on the <a href="https://threejs.org/docs/?q=camera#api/en/cameras/PerspectiveCamera">PerspectiveCameraclass</a> if you need help!)</li><li>…ok, let’s review the solution here — following the comments, your code can be implemented using something similar to the following:</li></ul><pre>/**<br> * Sets the contents of the scene to the given GLTF data.<br> * <br> * @param {object} gltfScene The GLTF data to render.<br> */<br>const setGltfContents = (gltfScene) =&gt; {<br>    // ...<br>    /** [Challenge 2]: Fixing the Camera Position */<br>    camera.position.copy(center);<br>    const boxSize = box.getSize(new Vector3());<br>    camera.position.x = boxSize.x * 2;<br>    camera.position.y = boxSize.y * 2;<br>    camera.position.z = boxSize.z * 2;<br>    // ...<br>};</pre><ul><li>Note: the <em>last 4 lines </em>of the code above is what’s especially important here. This tells Three.js we want our camera 2X the size of the “bounding box” surrounding our 3D model, to make sure we can fix the whole model in our viewer element once it loads (but hopefully not be too far either).</li><li>Test that “Click Me!” button once again. If you’re using the truck model, you should see it load, but now it should be in a much more natural starting position:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2k1SnolGpAcKO_HrMPVHA.png" /></figure><ul><li>Nicely done 🙌 ! You’ve now completed Challenge 2. Just as with Challenge 1, I’d encourage you to read up more on the various Three.js classes you’ve seen used here separately. Otherwise, let’s commit your progress and keep going:</li></ul><pre>$ git commit -am &quot;completed 3D model viewer using local gltfs&quot;</pre><h4>Step 3: Rendering glTFs from the Onshape REST API</h4><p>Up to now, we’ve built a 3D viewer for glTF models. This is great — but we’re restricted only to rendering whatever glTF files are on our local machine. This is where Onshape’s REST API comes in: with it, we’ll be able to let users request to view 3D models which we have stored in your Onshape account. Let’s go set that up now!</p><ol><li>To begin, let’s switch to the starter code for this section:</li></ol><pre>$ git checkout custom-server-starter</pre><p>2. Do you remember when I told you to ignore the package.jsonfile before? It’s going to be useful going forward. The main utility of this file will be to install all our Node dependencies — they’re all listed in the file, so we can install them using this npmcommand (from the root directory):</p><pre>$ npm install -i</pre><p>3. Next, the Onshape REST API was designed to take web security seriously, so we require developers to sign up for API keys before using it.</p><ul><li>Go to the <a href="https://dev-portal.onshape.com/signin">Onshape Developer Portal</a> and log in with the credentials for your Onshape account.</li></ul><figure><img alt="Screenshot of the Onshape Developer Portal —I know this is obvious, but please note that it should say “Developer Portal”." src="https://cdn-images-1.medium.com/max/1024/1*BCp3gO0IFPd78v_bZ3WcTA.png" /><figcaption>The Dev Portal should look something like this!</figcaption></figure><ul><li><em>But Zain, what if I have multiple Onshape accounts? </em>In this case, you’re going to want to choose the account that will have (at minimum) <strong>viewing permissions </strong>to whatever 3D models stored in Onshape that you want this glTF viewer to render.</li><li>Note: that is to say, if you’re planning to visualize 3D models that are private to you, you should be using your private Onshape account credentials. Otherwise, <em>don’t</em> sweat this step and just use any Onshape account you have — in this tutorial we’ll just be working with publicly available models, so you will have no trouble accessing them.</li><li>After logging into the Developer Portal: go to the <strong>“API keys”</strong> tab, and create a pair of new API keys to use.</li><li>Create a new file in the root of our local git repo, name it something like .env , so that we have a safe place to keep these API keys:</li></ul><pre>$ touch .env</pre><p>4. Next — let’s fill out your .env file. There are six in particular you’ll need for this tutorial. I’ve listed them below, please see the comments to know how you should fill them in:</p><pre>ONSHAPE_API_ACCESSKEY=...  # from the Dev Portal<br>ONSHAPE_API_SECRETKEY=...  # from the Dev Portal<br>PORT=3000  # or could be 5000, 8080, etc. - it&#39;s just where our web server will run<br>API_URL=https://cad.onshape.com/api<br>SESSION_SECRET=... # some long, hard to guess string with no spaces or quotes, e.g. &quot;kdjsf3$q%%G_4&amp;+22awgvAEQq&quot;<br>WEBHOOK_CALLBACK_ROOT_URL=...  # same as host name - use &quot;http://localhost:&lt;whatever-your-PORT-number-is&gt;&quot;</pre><p>5. Ok! It’s time to start integrating with Onshape’s API. Again, the goal here is that instead of reading glTF files from our local storage, we’re going to tell our web server request them from one of <em>Onshape’s </em>servers, before rendering in the browser. As you might guess, we’re going to need to write custom server-side code to do so — that’s where <strong>Express.js </strong>comes in.</p><ul><li><em>Why are we using Express?</em> Tbh, we’re using it here because I don’t want you to have to learn another programming language for this part of the tutorial. Express.js is an enormously popular <strong>web application framework</strong> for JavaScript. That basically means that if you can write JavaScript for the browser (and you <em>can</em>, since we did so previously), you can transfer that skill over to writing JavaScript for web servers (and of course, use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">docs</a> if you get stuck).</li><li>With that as background, we now need to figure out how to actually <em>start </em>a server in Express— let’s do that now in <strong>&quot;Challenge 1&quot;</strong>of this git branch! Flip over to the wwwfile now, and it should look like this:</li></ul><pre>#!/usr/bin/env node<br><br>/**<br> * [Challenge 1]: Starting the Server<br> * <br> * Starting Your Express Server<br> * Please do the following:<br> * a) load your config vars from the .env file,<br> * b) import the Node `app` object created in server.js,<br> * c) and set it up to listen on port 3000!<br> */<br><br>/** your code goes here */</pre><ul><li>Pause now, and please try Challenge 1 before moving ahead…</li><li>…alrighty! Your solution to Challenge should look similar to this:</li></ul><pre>#!/usr/bin/env node<br><br>/** Challenge 1 Solution */<br>// part a)<br>require(&#39;dotenv&#39;).config()<br>const port = process.env.PORT || 3000;<br>// part b) <br>const app = require(&#39;../server&#39;);<br>// part c) <br>app.listen(port, () =&gt; {});</pre><ul><li>Note: if you’re unclear on how the require() function works, I’d encourage you to read more about it <a href="https://nodejs.org/en/knowledge/getting-started/what-is-require/">here</a> before going forward.</li><li>Now then — how is this file supposed to start our server? Observe the comment at the top of the file, #!/usr/bin/env node . This comment (commonly referred to as a <em>shebang</em> line) is what tells us this file is actually meant to be an <em>executable.</em></li><li>As such, you can observe see that in package.json, we have a key named &quot;scripts&quot; , which lists the following:</li></ul><pre>// package.json<br>// ...<br>&quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;bin/www&quot;,<br>    &quot;dev&quot;: &quot;nodemon bin/www&quot;,<br>// ...</pre><ul><li><em>What does this mean? </em>This part of package.json is where we can specify custom npm commands, that others can execute when working with our project. Right now, we’re going to just focus on invoking the second script listed in this dictionary, dev.This is just for quality-of-life purposes — just as how we didn’t need to restart our web app when using the “Live Server” extension, nodemon will auto-reload our app after code changes (so that we don’t need to restart our server after each code change going forward, which can be cumbersome).</li><li>So, to run our bin/wwwexecutable using nodemon, please go back to your terminal and invoke our dev script:</li></ul><pre>$ npm run dev</pre><ul><li>Now, your server is running! To test, go to the address <a href="https://localhost:3000/">https://localhost:3000/</a> (or whichever port you’ve configured the app to use). You will see the following response on the page:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*WqQBLe7AWFu1pZpkRTxlVQ.png" /></figure><p>6. Obviously, we’re not done. As you might guess from the error message on the page, we have a running server— but that server now needs to be told where to find all the HTML/CSS for our web app, before it can serve up the content we need on the UI. Let’s tackle that in Challenge 2 and Challenge 3.</p><ul><li>Flip over to the file named server.js. The comment for Challenge 2 should look like this:</li></ul><pre>const path = require(&#39;path&#39;);<br><br>const express = require(&#39;express&#39;);<br>const bodyParser = require(&#39;body-parser&#39;);<br><br>const app = express();<br><br>app.set(&#39;trust proxy&#39;, 1); // To allow to run correctly behind Heroku<br><br>/**<br> * [Challenge 2]: Express Middleware<br> *<br> * Part a: Tell Express to serve the static files in our<br> * &#39;standalone&#39; directory. <br> *<br> * Part b: Then, let&#39;s tell Express we want to <br> * use the bodyParser.json() function, so that we can<br> * parse the contents of our API requests via HTTP.<br> *<br> */<br>/** your code goes here */</pre><ul><li>At the top, this starter code imports some Node modules, and instantiates our web app as a variable (aptly named app) using Express.js. Now, the next step is to add <em>middleware functions</em>—these are essentially functions our app will be able to use as it goes through the request-response cycle, so it’s an ideal place for us to add code that will be useful across all of our app request handlers. Now, go ahead and add these 2 lines of code under the comment for Challenge 2:</li></ul><pre>app.use(express.static(path.join(__dirname, &#39;standalone&#39;)));  // sets up a &quot;static&quot; folder<br>app.use(bodyParser.json());  // provides access the &quot;body&quot; of our HTTP requests</pre><ul><li>OK, so what’s going on here? For background, app.use() is generally the method we’ll call when utilizing middleware functions with Express. In particular, when we use express.static(), that is basically a way for us to tell Express where it can find all the <em>static </em>assets for our app, i.e. all the HTML/CSS/images, etc. You can test that this works by going to <a href="http://localhost:3000/html/index.html">http://localhost:3000/html/index.html</a> — if it did, we’ll be able to again to see our home page again from section 1!</li><li>So that’s express.static() what is the bodyParser? The TLDR is this middleware will allow us to read the “body” of the HTTP requests coming to our server , by storing it in a variable called req.body— this is something that is also useful for many kinds of server-side functions.</li><li>Alrighty, that takes care of Challenge 2 — but what about Challenge 3 ? Verify that you have the following comment at the bottom ofserver.js:</li></ul><pre>/**<br> * [Challenge 3]: Controller functions<br> *<br> * Part a: Add a namespace for the controller functions in<br> * api.js, so our Express can route request towards them.<br> * (note: we will see more of api.js in just a sec!)<br> *<br> * Part b: using res.sendFile(), add route handlers so <br> * that our app can server our index.html and viewer.html pages.<br> */<br>/** your code goes here */</pre><ul><li>Please read the comment in full, then come back once you have given it a shot. Don’t worry, I’ll wait :)…</li><li>…solution time!</li></ul><pre>/** [Challenge 3] */<br><br>// Part a)<br>app.use(&#39;/api&#39;, require(&#39;./api&#39;));<br><br>// Part b)<br>app.get(&#39;/&#39;, (req, res) =&gt; {<br>    res.sendFile(path.join(__dirname, &#39;standalone&#39;, &#39;html&#39;, &#39;index.html&#39;));<br>});<br><br>app.get(&#39;/truck-viewer&#39;, (req, res) =&gt; {<br>    res.sendFile(path.join(__dirname, &#39;standalone&#39;, &#39;html&#39;, &#39;viewer.html&#39;));<br>});</pre><p>A few points to note here:</p><ul><li>For part a), observe that we’re calling app.use()again, and just passing in a call to the require()function — so technically, you can consider this your first implementation of <em>custom </em>middleware!</li><li>For part b), the solution is basically just the Express.js-way of telling our server how to, well, <em>serve</em> the two HTML pages we worked on in the previous sections of this tutorial — the index.htmland the viewer page. You might ask though, <em>why </em>are these lines needed, if I told you that’s what we use the express.static() middleware for?</li><li>The answer is surprisingly simple — if we don’t, then we wouldn’t be able to use CSS on our server! (feel free to test this out by commenting out the line that includes express.static() and reloading the page).</li><li>For now — to verify our changes worked — please go to the home page route, “/”, by visiting <a href="http://localhost:3000/">http://localhost:3000/</a>. You should see our familiar home page again!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rx1XtnlweRAT2yuLSCvr6g.png" /></figure><p>7. Onward! So far we have added routes to serve all our HTML/CSS. Can you guess what we’ll need to add to our Express code, in order to grab data from the Onshape API?</p><ul><li>If you guessed “another route function”, you’d be correct! This is because a route is basically just a way for us to tell Express how to 1) take requests, 2) process them in some way, and 3) how to return the appropiate responses. So, just as we can setup routes where the request-response cycle is between users and our own server, the same can be done between our server, and other servers whose APIs we interact with (in this case, Onshape’s).</li><li>Speaking of APIs, let’s flip over to Challenge 4 to see how to make an API call to Onshape in Express. If you go to api.js, you should see the following starter code:</li></ul><pre>const { onshapeApiUrl } = require(&#39;./config&#39;);  // note: this is equal to whatever string you put for API_URL earlier!<br>const { forwardRequestToOnshape } = require(&#39;./utils&#39;);<br>    <br>const apiRouter = require(&#39;express&#39;).Router();<br><br>/**<br> * Retrieve glTF from a given Part Studio tab in an Onshape document. <br> * <br> * GET /api/get-gltf?documentId=...&amp;inputId=...&amp;idChoice=...&amp;gltfElementId=...<br> *      -&gt; 200, { ... }<br> *      -or-<br> *      -&gt; some error e.g. 400<br> * <br> * Read more/try out this endpoint in the docs: https://cad.onshape.com/glassworks/explorer#/PartStudio/exportPartStudioGltf<br> */<br> apiRouter.get(&#39;/get-gltf/:did/:wvm/:wvmid/:eid&#39;, async (req, res) =&gt; {<br>    // Extract the necessary IDs from the URL<br>    const did = req.params.did,<br>        wvm = req.params.wvm,<br>        wvmid = req.params.wvmid,<br>        eid = req.params.eid;<br><br>    /** [Challenge 4]: Making a Request to the Onshape API<br>     * <br>     * First, let&#39;s pause and take a sec to read about the &quot;Export glTF&quot; endpoint we&#39;ll be using<br>     * in our app: https://cad.onshape.com/glassworks/explorer#/PartStudio/exportPartStudioGltf.<br>     * Then, use the `forwardRequestToOnshape()` function (defined in utils.js)<br>     * to make a request to this endpoint!!<br>     *<br>     * Hint: the args you&#39;ll need to pass to forwardRequestToOnshape() are the following:<br>     *  1) a template string that uses all the ^params above, to make a well-formed URI,<br>     *  2) the request object, and <br>     *  3) the response object found in our code...<br>     */<br>    /** your code goes here */<br>});</pre><p>Lots of code right? Let’s break it down a little:</p><ul><li>We’re using the “<a href="https://cad.onshape.com/glassworks/explorer#/PartStudio/exportPartStudioGltf">exportPartStudioGltf</a>” endpoint from the Onshape REST API. Like the name suggests, it will retrieve a glTF model for you, provided the proper information about the Part Studio where that model is defined (more on that in a moment). For now, feel free to play around with this endpoint in our <a href="https://cad.onshape.com/glassworks/explorer#/PartStudio/exportPartStudioGltf">documentation</a> so you’ll be more comfortable using it for this tutorial.</li><li>Secondly, the comment above refers to a function called forwardRequestToOnshape() — what is this function? For your edification, I’ve pasted it below:</li></ul><pre>/**<br> * Send a request to the Onshape API, and proxy the response back to the caller.<br> * <br> * @param {string} apiPath The API path to be called. This can be absolute or a path fragment.<br> * @param {Request} req The request being proxied.<br> * @param {Response} res The response being proxied.<br> */<br>forwardRequestToOnshape: async (apiPath, req, res) =&gt; {<br>    try {<br>        // API request authorization<br>        const normalizedUrl = apiPath.indexOf(onshapeApiUrl) === 0 ? apiPath : `${onshapeApiUrl}/${apiPath}`;<br>        const encodedString = Buffer.from(`${config.accessKey}:${config.secretKey}`).toString(&#39;base64&#39;);<br>        const resp = await fetch(normalizedUrl, { headers: { <br>            Authorization: `Basic ${encodedString}`,<br>        }});<br>        const data = await resp.text();<br>        const contentType = resp.headers.get(&#39;Content-Type&#39;);<br>        res.status(resp.status).contentType(contentType).send(data);<br>    } catch (err) {<br>        res.status(500).json({ error: err });<br>    }<br>}</pre><ul><li>I would encourage you to pause here and read more into the functions to understand it better. Essentially, this abstracts away a lot of the complexity in authorizing API requests we make to Onshape (i.e. by including those keys you got from the dev portal earlier when we call fetch()). Although this is mostly boilerplate, it’s super important from a security standpoint!</li><li>Ok, now, please give a go at Challenge 4…</li><li>…and afterwards, take a look at the solution!</li></ul><pre>apiRouter.get(&#39;/get-gltf/:did/:wvm/:wvmid/:eid&#39;, async (req, res) =&gt; {<br>    // Extract the necessary IDs from the URL (included in the request)<br>    // ...<br><br>    /** [Challenge 4]: Making a Request to the Onshape API */<br>    forwardRequestToOnshape(<br>        // 1) a template string:<br>        `${onshapeApiUrl}/partstudios/d/${did}/${wvm}/${wvmid}/e/${eid}/gltf`,<br>        // 2) the request object, and 3) the response object passed to this function:<br>        req, res<br>    );<br>});</pre><p>Ok, let’s review — first off, a word on the template string — what the heck do the parameters did , wvm, wvmid, and eid refer to?</p><ul><li>To answer this, let’s observe a parallel example: when you go to open a document in Onshape, the URL path you follow on our servers abides by the same naming scheme. For instance, in the document link <a href="https://cad.onshape.com/documents/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/e/12bd0e929396835dadeaa83b?renderMode=0&amp;uiState=63a76a21d12f2f36e4bebae5">https://cad.onshape.com/documents/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/e/12bd0e929396835dadeaa83b?renderMode=0&amp;uiState=63a76a21d12f2f36e4bebae5</a>:</li><li>the substring “…/<a href="https://cad.onshape.com/documents/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/e/12bd0e929396835dadeaa83b?renderMode=0&amp;uiState=63a76a21d12f2f36e4bebae5">documents/c1c54c370fa5185f0a52ed15</a>/…” tells you what the <em>document ID </em>(abbreviated didin the API) is in our databases,</li><li>the “…/w/<a href="https://cad.onshape.com/documents/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/e/12bd0e929396835dadeaa83b?renderMode=0&amp;uiState=63a76a21d12f2f36e4bebae5">1b249e369705d99ca986bec1</a>/…” tells you we’re about to use a workspace ID to refer to whatever we want to request (as opposed to using the ID of a version/microversion of the document); and then we provide that ID,</li><li>and the substring “…/<a href="https://cad.onshape.com/documents/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/e/12bd0e929396835dadeaa83b?renderMode=0&amp;uiState=63a76a21d12f2f36e4bebae5">e/12bd0e929396835dadeaa83b</a>/…” tells you the ID of the <em>element </em>we want to refer to, of that particular document.</li><li>**When you see the term “element” used in our API, that is the <em>exact same </em>as what regular users think of as individual <em>tabs</em> in an Onshape document!**</li></ul><p>With this knowledge, we’re now empowered to test out the API route you just added to our Express app. How so?</p><ul><li>Using the document link above (or one of your own), send a request to this API route using the proper path parameters! We can do this all in our terminal using the curl command— here is an example:</li></ul><pre>$ curl http://localhost:3000/get-gltf/c1c54c370fa5185f0a52ed15/w/1b249e369705d99ca986bec1/12bd0e929396835dadeaa83b/</pre><ul><li>After you do this, it should take a second and then — voila! You’ll see something come through — <em>that </em>is a response coming back from the Onshape server. It should look something like this:</li></ul><pre>{&quot;extensions&quot;:{&quot;PTC_onshape_metadata&quot;:{&quot;documentId&quot;:&quot;c1c54c370fa5185f0a52ed15&quot;,&quot;elementId&quot;:&quot;12bd0e929396835dadeaa83b&quot;}},&quot;extensionsUsed&quot;:[&quot;PTC_onshape_metadata&quot;],&quot;accessors&quot;:[{&quot;bufferView&quot;:0,&quot;byteOffset&quot;:0,&quot;componentType&quot;:5126,&quot;count&quot;:1493,&quot;type&quot;:&quot;VEC3&quot;,&quot;max&quot;:[1.86,3.4003837,1.0279473],&quot;min&quot;:[0.0,-2.011272,-1.0765781]},{&quot;bufferView&quot;:1,&quot;byteOffset&quot;:0,&quot;componentType&quot;:5126,&quot;count&quot;:1493,&quot;type&quot;:&quot;VEC3&quot;},{&quot;bufferView&quot;:2,&quot;byteOffset&quot;:0,&quot;componentType&quot;:5123,&quot;count&quot;:5442,&quot;type&quot;:&quot;SCALAR&quot;}],&quot;asset&quot;:{&quot;version&quot;:&quot;2.0&quot;},&quot;buffers&quot;:...</pre><ul><li>Boom! If you see this, that means you’ve just successfully requested a glTF over our API!</li></ul><p>8. At long last, we’ve seen how to programmatically request and receive glTF data from the Onshape API — but we have yet to integrate this functionality into our viewer on the UI. Let’s take care of that in Challenge 5and Challenge 6:</p><ul><li>First looking at any more code, let’s go visit the updated viewer page in the browser. Go to <a href="http://localhost:3000/truck-viewer">http://localhost:3000/truck-viewer</a>, and you should see something similar to the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MK2yg7g0mDFSrpriT_bB7A.png" /></figure><ul><li>Whoa, what is this form doing here? Let’s flip over to viewer.html — the form you see there can explain more. While you’re there, also take a look at where Challenge 5 is described:</li></ul><pre>&lt;!-- Form to &quot;feed&quot; API call to retrieve glTF --&gt;<br>&lt;div id=&quot;elem-selector&quot; class=&quot;mb-5&quot;&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;!-- <br>            [Challenge 5]: Collecting Data from Users<br>            <br>            To be able to make requests to retrieve the specific<br>            glTF our users ask for, we&#39;re collecting the parameters<br>            we&#39;ll need to make API calls to Onshape <br>            (i.e. the document ID, element ID, workspace ID, etc.) via this HTML form.<br><br>            But in order to eventually pass the data from our HTML to the backend server,<br>            we&#39;ll need to add a unique `id` string for each of the fields<br>            in the form below, so we can tell JavaScript where to go access it <br>            (we&#39;ll dive deeper into this in a future step, so don&#39;t worry if it<br>            sounds a little confusing right now).<br>            <br>            ACTION: go ahead and fill in the &#39;id&#39; attributes for each form<br>            field below, so that they are unique from each other.<br>            The places you need to edit are marked &#39;YOUR ID GOES HERE&#39;, so you won&#39;t miss :)<br>         --&gt;<br>        &lt;label for=&quot;documentIdInput&quot;&gt;Document ID&lt;/label&gt;<br>        &lt;input name=&quot;documentId&quot; type=&quot;text&quot; <br>               class=&quot;form-control&quot; id=&quot;YOUR ID GOES HERE&quot; <br>               aria-describedby=&quot;documentIdHelp&quot; value=&quot;f246b429ad653513d90defe2&quot;&gt;<br>        &lt;small id=&quot;documentIdHelp&quot; class=&quot;form-text text-muted&quot;&gt;Please enter the ID of your Onshape document.&lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;label for=&quot;wvmSingleChoiceSelect&quot;&gt;Select which &quot;Type&quot; of ID you have:&lt;/label&gt;<br>        &lt;select class=&quot;form-control&quot; id=&quot;YOUR ID GOES HERE&quot; name=&quot;idChoice&quot;&gt;<br>          &lt;option&gt;w&lt;/option&gt;<br>          &lt;option&gt;v&lt;/option&gt;<br>          &lt;option&gt;m&lt;/option&gt;<br>        &lt;/select&gt;<br>        &lt;small id=&quot;idChoiceHelp&quot; class=&quot;form-text text-muted&quot;&gt;<br>            w = &quot;workspace ID&quot;; v = &quot;version ID&quot;; m = &quot;microversion ID&quot;<br>        &lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;label for=&quot;wvmIdInput&quot;&gt;WVM ID&lt;/label&gt;<br>        &lt;input name=&quot;providedId&quot; type=&quot;text&quot; <br>               class=&quot;form-control&quot; id=&quot;YOUR ID GOES HERE&quot; <br>               aria-describedby=&quot;providedIdHelp&quot; value=&quot;467dd42ecaa46be04cc2500a&quot;&gt;<br>        &lt;small id=&quot;providedIdHelp&quot; class=&quot;form-text text-muted&quot;&gt;<br>            Please enter the ID of your workspace, current version, <br>            or microversion (must correspond to the &quot;type&quot; of ID chosen above).<br>        &lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;label for=&quot;elementIdInput&quot;&gt;Element ID&lt;/label&gt;<br>        &lt;input name=&quot;elementId&quot; type=&quot;text&quot; <br>               class=&quot;form-control&quot; id=&quot;YOUR ID GOES HERE&quot; <br>               aria-describedby=&quot;eIdInputHelp&quot; value=&quot;eff42e24b584233240dff36f&quot;&gt;<br>        &lt;small id=&quot;elementIdHelp&quot; class=&quot;form-text text-muted&quot;&gt;<br>            I think you can figure what this one means 😄<br>        &lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;button id=&quot;formSubmitButton&quot; type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt;<br>&lt;/div&gt;</pre><ul><li>What is this saying? We know that before our server request a glTF to the Onshape API, we need some way for a regular user to tell it <em>which </em>glTF to get, based on the parameters the API requires (discussed above).</li><li>(Note: at this point, in the real world you would probably need to go to your Product Manager or UI/UX Designer to have a conversation about this — but for this tutorial, we’re just going to have our users submit the parameters through the form you saw above, which our server will parse in order to get the variables needed for the API request). So the form is <em>not </em>the only way we could implement this user journey, but it will help keep things simple for your learning :)</li><li>Now, on to the challenge! We can see the starter code for the form comes with default values which you could use. But, we still need a way for our JavaScript to be able to parse the data submitted under particular form fields — that’s where you come in. Go ahead and fill in where it says &quot;YOUR ID GOES HERE&quot;in the viewer.html.</li><li>Although you can use a variety of different ID strings, an easy option for doing this is just to reuse the string in the forattribute of each &lt;label&gt;component placed in the starter code — here is an example solution:</li></ul><pre>&lt;!-- Form to &quot;fill in&quot; API req params to retrieve glTF --&gt;<br>&lt;div id=&quot;elem-selector&quot; class=&quot;mb-5&quot;&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;!-- [Challenge 5]: Collecting Data from Users --&gt;<br>        &lt;label for=&quot;documentIdInput&quot;&gt;Document ID&lt;/label&gt;<br>        &lt;input name=&quot;documentId&quot; type=&quot;text&quot; <br>               class=&quot;form-control&quot; id=&quot;documentIdInput&quot;  <br>               aria-describedby=&quot;documentIdHelp&quot; value=&quot;f246b429ad653513d90defe2&quot;&gt;<br>        &lt;small id=&quot;documentIdHelp&quot; class=&quot;form-text text-muted&quot;&gt;Please enter the ID of your Onshape document.&lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;label for=&quot;wvmSingleChoiceSelect&quot;&gt;Select which &quot;Type&quot; of ID you have:&lt;/label&gt;<br>        &lt;select class=&quot;form-control&quot; id=&quot;wvmSingleChoiceSelect&quot; name=&quot;idChoice&quot;&gt;<br>          &lt;option&gt;w&lt;/option&gt;<br>          &lt;option&gt;v&lt;/option&gt;<br>          &lt;option&gt;m&lt;/option&gt;<br>        &lt;/select&gt;<br>        &lt;small id=&quot;idChoiceHelp&quot; class=&quot;form-text text-muted&quot;&gt;<br>            w = &quot;workspace ID&quot;; v = &quot;version ID&quot;; m = &quot;microversion ID&quot;<br>        &lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;label for=&quot;wvmIdInput&quot;&gt;WVM ID&lt;/label&gt;<br>        &lt;input name=&quot;providedId&quot; type=&quot;text&quot; <br>               class=&quot;form-control&quot; id=&quot;wvmIdInput&quot; <br>               aria-describedby=&quot;providedIdHelp&quot; value=&quot;467dd42ecaa46be04cc2500a&quot;&gt;<br>        &lt;small id=&quot;providedIdHelp&quot; class=&quot;form-text text-muted&quot;&gt;<br>            Please enter the ID of your workspace, current version, <br>            or microversion (must correspond to the &quot;type&quot; of ID chosen above).<br>        &lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;form-group&quot;&gt;<br>        &lt;label for=&quot;elementIdInput&quot;&gt;Element ID&lt;/label&gt;<br>        &lt;input name=&quot;elementId&quot; type=&quot;text&quot; <br>               class=&quot;form-control&quot; id=&quot;elementIdInput&quot; <br>               aria-describedby=&quot;eIdInputHelp&quot; value=&quot;eff42e24b584233240dff36f&quot;&gt;<br>        &lt;small id=&quot;elementIdHelp&quot; class=&quot;form-text text-muted&quot;&gt;<br>            I think you can figure what this one means 😄<br>        &lt;/small&gt;<br>    &lt;/div&gt;<br>    &lt;button id=&quot;formSubmitButton&quot; type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt;<br>&lt;/div&gt;<br>&lt;div id=&#39;gltf-viewport&#39;&gt;&lt;/div&gt;<br>&lt;/div&gt;</pre><ul><li>Good stuff! As you can see, we’ve just filled in the idattribute of the form fields. Please check to ensure your id strings are <em>unique </em>to their respective HTML elements — this is so that JavaScript will have no trouble locating them later (this statement will make more sense in a second, I promise).</li><li>Next, let’s go find Challenge 6. Do you remember when we implemented an event listener earlier in this tutorial? Well, let’s go revisit index.js — in it, you should see the following comment:</li></ul><pre>// (3) setup for loading glTF based on user selection<br>formSubmitBtn.addEventListener(&#39;click&#39;, async (evt) =&gt; {<br>    // retrieve form values + access the glTF<br>    try {<br>        document.body.style.cursor = &#39;progress&#39;;        <br>        /**<br>         * [Challenge 6]: Accessing Data from the Front-End:<br>         * <br>         * On the next four lines, we now access the data inputted<br>         * by users into the form on our viewer.html page <br>         * (so that we have all the parameters needed to <br>         * complete that fancy-pants API request you made in Challenge 4).<br>         * <br>         * Now, do you remember what &#39;id&#39; strings you gave <br>         * to each field in that form?<br>         * <br>         * Using those same id strings for each of your form fields,<br>         * go ahead and store the value of each field in a<br>         * new JavaScript variable!<br>         * <br>         */<br>        const did = document.getElementById(&quot;YOUR ID GOES HERE&quot;).value,<br>              wvm = document.getElementById(&quot;YOUR ID GOES HERE&quot;).value,<br>              wvmid = document.getElementById(&quot;YOUR ID GOES HERE&quot;).value,<br>              eid = document.getElementById(&quot;YOUR ID GOES HERE&quot;).value;<br><br>        poll(5, () =&gt; fetch(`/api/get-gltf/${did}/${wvm}/${wvmid}/${eid}`), <br>            (resp) =&gt; resp.status === 200, (respJson) =&gt; {<br>            if (respJson.error) {<br>                displayError(&#39;There was an error in parsing the glTF to a JSON string.&#39;);<br>            } else {<br>                console.log(&#39;Loading GLTF data...&#39;);<br>                loadGltf(respJson);<br>            }<br>        });<br>    } catch (err) {<br>        displayError(`Error requesting GLTF data translation: ${err}`);<br>    }</pre><ul><li><em>Hmm… event listener, you look a little different. Did you get a new haircut?</em> 💇‍♂️</li><li>In all seriousness, do you see where the starter code calls fetch(`/api/get-gltf/${did}/${wvm}/${wvmid}/${eid}`)? <em>This </em>is in fact crucial, because this connects the front-end of our app to the API route we implemented earlier in this section using Express. Now, go ahead and complete this challenge, by replacing in the &quot;YOUR ID GOES HERE&quot;strings with the corresponding IDs you placed in the viewer.htmlform. If you’re following along with my example, the solution should look similar to this:</li></ul><pre>// (3) setup for loading glTF based on user selection<br>formSubmitBtn.addEventListener(&#39;click&#39;, async (evt) =&gt; {<br>    // retrieve form values + access the glTF<br>    try {<br>        document.body.style.cursor = &#39;progress&#39;;        <br>        /** [Challenge 6]: Accessing Data from the Front-End */<br>        const did = document.getElementById(&quot;documentIdInput&quot;).value,<br>              wvm = document.getElementById(&quot;wvmSingleChoiceSelect&quot;).value,<br>              wvmid = document.getElementById(&quot;wvmIdInput&quot;).value,<br>              eid = document.getElementById(&quot;elementIdInput&quot;).value;<br><br>        poll(5, () =&gt; fetch(`/api/get-gltf/${did}/${wvm}/${wvmid}/${eid}`), <br>            (resp) =&gt; resp.status === 200, (respJson) =&gt; {<br>            if (respJson.error) {<br>                displayError(&#39;There was an error in parsing the glTF to a JSON string.&#39;);<br>            } else {<br>                console.log(&#39;Loading GLTF data...&#39;);<br>                loadGltf(respJson);<br>            }<br>        });<br>    } catch (err) {<br>        displayError(`Error requesting GLTF data translation: ${err}`);<br>    }<br>});</pre><ul><li><em>Parfait. </em>At this point, the form in the viewer.html should be able to request, receive, <em>and</em> render any multitude of 3D CAD models you have stored in Onshape (the only restriction at this point is they should be Part Studios which you have permissions to view regularly, just like when you go to <a href="https://cad.onshape.com)./">https://cad.onshape.com).</a></li><li>Go ahead and try out the form now — you can either submit it using the default form values, or feel free to render any Part Studio models you have (using what we discussed earlier, related to how to get the required API parameters from an Onshape document URL). For an example of what a “successful” result should look like, see the demo video I included at the top of this blog.</li></ul><h3>Conclusion</h3><p>Congratulations on making it to the end! 👏 Please take a moment to reflect on all that you’ve achieved today.</p><h4>So, Why Do We Build for the Web?</h4><p>To wrap it up in a sentence — successful collaboration is at the <strong>heart</strong> of successful product development. And collaboration does <em>not</em> just refer to your engineers and designers working together to develop the next version of your product. Whether you’re Jony Ive at Apple or a brand-spanking-new founder running your own hard-tech startup, the best companies don’t let their CAD systems create silos. Instead, they enable every department outside of R&amp;D to work on top of the same 3D CAD data — this can <strong>save enormous amounts of time</strong> in sharing models, and can be especially instrumental when you need to <strong>build custom applications </strong>whose value isn’t strictly tied to R&amp;D, such as landing pages for the product or ERP systems. But the question is: <em>how</em> do you design such a software system to enable this collaboration?</p><p>At <a href="https://www.onshape.com/en/">Onshape</a>, our answer can be summed up in two words: the web. We believe there’s numerous benefits to having your enterprise software run on the cloud. We can’t wait to see what kinds of new apps you build with our 3D CAD tools, and that includes our REST API. Definitely feel free to <a href="https://www.linkedin.com/in/zain-train/">reach out to me</a> if you have feedback on how this tutorial went for you also.</p><p>Now, go build!</p><h3>Additional Resources</h3><ol><li><a href="https://github.com/sraza-onshape/OnshapeExperiments/tree/main/gltf-viewer-api-keys">Companion Repo</a> on GitHub — please see the main branch for an example of what a finished project may look like.</li><li><a href="https://github.com/Tech-at-DU/Launch-Page-Tutorial">The Product Launch Page Tutorial</a> at the Dominican University of California — this was the source material that inspired Step 1 of this blog. Please read if you like to dive further into front-end development. Huge shout-out to my former instructor, Adam Braus, and his team for creating this resource!</li><li><a href="https://threejs.org/manual/#en/fundamentals">Three.js Fundamentals</a> is a fantastic free resource to go deeper into the library for beginners.</li><li><a href="https://www.youtube.com/watch?v=L72fhGm1tfE">Traversy Media’s Crash Course on Express.js</a> — offers a deeper look at the Node.js concepts covered in Step 3 of this tutorial.</li><li>Last but not least, check out the official <a href="https://onshape-public.github.io/docs/integrationguide/">Onshape documentation</a> for a deeper dive into our <a href="https://onshape-public.github.io/docs/integrationguide/">integration methodologies</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1fe65369b35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 4 Areas to Focus on in Applied AI Research]]></title>
            <link>https://zain-raza.medium.com/the-4-areas-to-focus-on-in-applied-ai-research-29ec05b7397a?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/29ec05b7397a</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[focus]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[career-advice]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Sat, 10 Sep 2022 17:34:08 GMT</pubDate>
            <atom:updated>2022-09-10T17:34:08.517Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Bottom Line — It All Comes Back to How We Prioritize Time</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8cMvgsP-5FsAZbgpx2Vgg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@miabaker?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Mia Baker</a> on <a href="https://unsplash.com/s/photos/whiteboard?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><h3>Why Care About Prioritizing Ti<em>me?</em></h3><p>Let’s be clear —if you’re early in your career in AI, then this blog might not be worth caring about (for now).</p><p><strong>That’s because this blog post is about the future. </strong>If you’re reading this, I’m going to guess that you’re probably interested in pursuing research at some point. In which case, that probably means you’re excited to see how your ideas could change the world, in one of the field where machine learning is being applied at the moment (e.g. from healthcare, autonomous vehicles, wearables, and the list goes on).</p><p>If that is the case, I have both good news and bad news. Let’s start with what’s bad:</p><p><strong>As exciting as research can be, the reality is that creating machine learning models can be incredibly tedious work.</strong></p><p>For example, when doing machine learning in industry you <em>might</em> just start a project and discover that:</p><ul><li>you have to write an ETL script all from scratch, as no pre-existing data sources exist at your lab/company</li><li>your hardware accelerators are underpowered, and therefore you need to wait hours/days in between trainings before analyzing your experiments</li><li>and if you opt to train models in the cloud, you might still need to set up AWS EC 2 instances all on your own, so that you can use faster hardware</li></ul><p>This is because for many companies, machine learning is still relatively nascent. That means for you, me, and many practitioners I know in the field, we might have started in AI research because we wanted to be the next Geoff Hinton — but instead, we can become bogged down with being responsible for several functions <em>beyond just doing research</em>.</p><p>If this sounds like you, or it sounds like what you want to avoid, there’s good news too: <strong>many people have been in your shoes before</strong>. Most of us eventually do get to the point where we <em>are </em>able to minimize the effects of feeling overwhelmed in research (e.g. going into burnout, missing project deadlines, going over budget, etc.). We rarely fall into those pitfalls.</p><h4>Goal of the Blog</h4><p>My aim in this blog is to make that process shorter for you, by sharing what has (and hasn’t) worked for me. Because I’m speaking from experience, this should be most relevant to Applied AI researchers/engineers at smaller startups. However, anyone who’s at a company where AI is still “new” to the engineering culture might still benefit.</p><p>I’ll share the <strong>4 areas</strong> that truly deserve your attention when you’re developing models for machine learning projects. My goal is to by the end of this blog, you will feel more empowered to:</p><ol><li>Brainstorm projects that let you <strong>dive deeper into any technical area you want to expand in</strong>,</li><li>Increase <strong>job satisfaction</strong> by reducing distractions and (in turn) getting more done,</li><li>Build a <strong>world-class support network</strong> in your company who will fuel your trajectory up the ladder.</li></ol><h4><em>Disclaimer</em></h4><p>The goal of this blog is <strong>not</strong> to give you the right goals to prioritize upfront. Only you can do that. Please treat this instead as a starting point, to make sure you at least know where to look for valuable work in your own environment.</p><p>Also, there are several competencies that make a great researcher that I already <strong>assume</strong> you know, e.g. being able to read and self-study academic papers related to whatever domain you’re working in. <em>But, </em>in case you aren’t familiar with these skills, I would highly recommend the <a href="https://gradcoach.com/blog/">GradCoach Blog</a> as a free resource to learn more.</p><p>If you have any questions, absolutely feel free to contact me; because we probably all could benefit from collaborating on developing better work-styles and goal setting strategies :)</p><h3>4 Types of Priorities to Plan Work Around</h3><p>So let’s say you sit down on Day 1 of your new project. You hop into a meeting with your manager about the new machine learning project (of which you’re leading). And they ask you “what are your goals for this?” — how do you reply?</p><p>The irony I find is, research inherently requires us to explore and think <em>broadly</em>. When setting goals however, alot of places typically look for a clear, <em>specific</em> outcome from our work. So how do we ensure we are making the most innovative work as researchers, while also delivering tangible value at the end of the day, so that our company succeeds?</p><p>Here are the four areas in which I try to look for valuable problems to solve:</p><h4>I: Contributing to the “Sprint”</h4><p>If you’re familar with agile development, you probably are familiar with what a sprint is. This is when you would be coding new features, fixing bugs, writing tests, and other things like being on-call for build issues (and of course, code review).</p><ul><li><strong>How does this apply to research?</strong></li></ul><p>I get it— not everyone like agile. But one hidden advantage of working in sprints is you get to make <strong>small wins.</strong> I once went to a mentor when I first working on a computer graphics project for a WebVR startup called iQ3Connect. I had been stuck on a single problem for weeks, even though I was reading ~10 papers a week on the subject. I asked him what I could do to break out of the stagnation in my research project. His advice:</p><p><strong>Break. Things. Down.</strong></p><p>In my case, if I could go back I would definitely have spent more effort on solidifying my foundational knowledge, as opposed to always scanning the field for new developments.</p><p>For graphics specifically, this could be as simple as taking a quick break in the middle of the week to refresh yourself on Peter Shirely’s<a href="https://raytracing.github.io/books/RayTracingInOneWeekend.html"><em> </em><strong><em>Ray Tracing in One Weekend</em></strong></a><strong><em> </em></strong>(2020)<strong>. </strong>For machine learning, if you’re working with a CNN, you might want to try and refresh on <a href="https://colab.research.google.com/drive/1KvJqP4qne5rkOMrJEHCXhk2R5oQ7PxSZ">how to write a convolution function</a> from scratch.</p><h4>II: Contributing to the Team</h4><p>If the first area applied to your current “sprint”, then this applies to how the team will handle future sprints.</p><p>Truth be told, I have only worked on small teams so far in industry. But the benefits of a strong team dynamic are probably always worth pursuing. That’s because in both research and engineering, we need collaborators.</p><p><strong>In pure software development, </strong>your work here might look like improving the team wiki/docs (e.g. on how we write tests), having sprint reviews, reducing tech debt, finding/being a mentor to someone.</p><p>In AI research, you can still do alot of these same things! For example, take the time to explain the TensorFlow API to a newcomer over StackOverflow (here’s my own <a href="https://stackoverflow.com/questions/57347833/image-data-augmentation-using-image-data-generator-in-keras/71280834#71280834">example</a>), or refactor the variable names in the official GitHub implementation of your favorite paper.</p><ul><li><strong>Pro-tip #1</strong>: one of the benefits I promised you above is being better at brainstorming new project ideas — one way I’ve done this is by setting up “informational interviews” with people around the org (or those you interact with on the platforms mentioned above) in the first few months on the job. An extra tip by <a href="https://www.amazon.com/gp/product/1092964282/ref=dbs_a_def_rwt_bibl_vppi_i4">Adam Braus</a> here: start with managers who are <em>not</em> in charge of your team (because it’ll be more relaxed).</li></ul><h4>III: Contributing to the Org</h4><p>To explain this area, let’s go back for a moment to when we were in school. When you did a machine learning project back then, did you ever need to worry about where the dataset came from? Or how you would deploy the model? Even, how you would <em>re-deploy </em>the<em> </em>model over time as needed?</p><p>All these operations — sometimes called “DataOps” or “MLOps” today — are a part of what separates effective teams working on machine learning, to those who are not. From those who can handle large, unstructured datasets, from those that aren’t.</p><p>Out of the four areas, I would argue this is the most similar to normal software engineering in industry — and again, it’s another high-value place to interesting problems. You might find yourself:</p><ul><li>creating Docker images to streamline environment setup for people who join your project</li><li>(or if you’re into <a href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file">Anaconda</a>, “environment.yml” also comes into play here),</li><li>creating a mini-machine learning framework (<a href="https://github.com/UPstartDeveloper/samaj">my example here</a>) for developers to implement common tasks faster (e.g. logging model metrics)</li></ul><p>Whatever it looks like for you, be proud of what you do in this area— this kind of work is <em>innovative </em>because the impact of these activities is outside what we can see in a single sprint; instead, they can potentially be felt for many months/years into the future.</p><ul><li><strong>Pro-tip #2</strong>: objective #2 is about preventing stagnation — one way that’s helped me do this better is keeping a daily journal of what I’m learning about the org — so I can learn how to unblock issues faster</li></ul><h4>IV: Contributing to the Industry</h4><p>OK, so I actually don’t have many recommendations for this area. That’s because if you’re able to protect your time and set up systems properly, this is probably the area you’ll end up making the most impact in anyway, by getting to do your awesome research in the first place :)</p><p>Usually, what I’ve noticed is this usually takes the form of creating new components for your company’s infrastructure (perhaps more so if your research is in architecture) or all new fields of business entirely. I will go ahead and cite a few examples of this, as a source of inspiration when setting your own goals:</p><p><strong>Examples</strong>:</p><ul><li><a href="https://youtu.be/yCd3CzGSte8?t=1617">Chris Lattner</a> (research example): interview clip speaking about the way Java “changed the world”</li><li>Amazon (architecture example): after they restructured their APIs + started running on their own servers → led to a whole new branch of their business as a cloud provider, <a href="https://techcrunch.com/2016/07/02/andy-jassys-brief-history-of-the-genesis-of-aws/">AWS</a>, which so many of us use today</li><li><strong>Pro-tip #3 </strong>— objective #3 is about creating space to do what really interests you — the tip here (just like in pro-tip #1) might be again to meet new people and do informational interviews . BUT, the key difference is they should ideally be <strong>people closer to your level </strong>(e.g. people who are 1–2 yrs ahead of you, as opposed to managers). I’ve found this population tends to know more about opportunities like internal hackathons, OSS projects, etc. the company has, where you can scratch that creative itch :)</li></ul><h3>Conclusion</h3><h4>Let’s recap</h4><p>Let’s be clear: this post doesn’t promise you that your research will succeed. If there’s anything I’ve learned, there doesn’t seem to be any hard guarantee of that.</p><p>I’ve yet to meet anyone who’s truly found a way to balance the goals they have for their AI project, with the changing demands that come from the actual work environment they go into (regardless of whether that be in the form of the existing infrastructure/data/people, or just that your final conclusions go against your hypothesis). Therefore, I thought this would be a worthwhile post to write.</p><h4>Where to Now?</h4><blockquote>“How we spend our days is, of course, how we spend our lives” — Annie Dillard</blockquote><p>Here’s why I love the quote above: at the end of the day, we — as AI researchers — tend to dream a lot about the future. We’re ambitious.</p><p>But perhaps just as important as ambition, is being able to reframe our definition of success in light of change. To be able to make use of our time, even if our projects don’t end up exactly reaching the destination we envisioned originally.</p><p>I’ve shared with you 4 areas where you can add value, that are adjacent to doing your actual AI research. They are:</p><p><strong>I: Contributing to the “Sprint”</strong></p><p><strong>II: Contributing to the Team</strong></p><p><strong>III: Contributing to the Org</strong></p><p><strong>IV: Contributing to the Industry</strong></p><h4>My ask for the Reader</h4><p>Now that you know about these areas, I invite you to see how they can supplement your own work in AI:</p><ul><li><strong>Do your own reflection in response to this post</strong>:</li><li>How well are you doing in prioritizing these areas? Do you feel you get enough done?</li><li>What could your next steps be to create more value?</li><li>What feedback do you have for the author (i.e. me?) What do you prioritize as a software engineer, and/or what could I have mentioned in addition to what’s above (or elaborated on clearly)?</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29ec05b7397a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Train a Sparse Neural Radiance Field, on AWS EC 2]]></title>
            <link>https://zain-raza.medium.com/how-to-train-a-sparse-neural-radiance-field-on-aws-ec-2-5024081d68be?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/5024081d68be</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[neural-radiance-fields]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 02:25:40 GMT</pubDate>
            <atom:updated>2022-04-10T18:45:49.420Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Setup Training for a Sparse Neural Radiance Grid, on AWS EC 2</h3><figure><img alt="ASCII art showing a camera icon." src="https://cdn-images-1.medium.com/max/1024/1*Ogy5hQ8jJ3Z18QWjquGpEg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@swimstaralex?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Alexander Sinn</a> on <a href="https://unsplash.com/s/photos/binary?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>An EC 2 Setup Guide</h3><p>“<a href="https://phog.github.io/snerg/">Sparse Neural Radiance Grids</a>” (abbreviated “SNeRG”) [<a href="https://phog.github.io/snerg/">1</a>] are no doubt one of the hottest inventions to come out of last October’s ICCV 2021. And with good reason: it can generate 3D models <em>without</em> actually needing to store the 3D triangle meshes on disk. This makes it a particularly exciting area for 3D reconstruction research. As the <a href="https://phog.github.io/snerg/">project page</a> for the paper shows, it renders the 3D model in the web browser in real-time, with nearly photorealistic graphical quality. You can hear the author of the paper, Peter Hedman, explain:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5jKry8n5YO8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5jKry8n5YO8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5jKry8n5YO8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/363c9dbf108c771d160e41175bb9636e/href">https://medium.com/media/363c9dbf108c771d160e41175bb9636e/href</a></iframe><p>In just a few years, we might start seeing algorithms all over the place, from how we train self-driving cars to augmented reality applications.</p><p>Sooo, the question you might is: how can I start using SNeRG my AI projects?</p><p>I personally have been using it in my current role for just about every day this past month, and this blog is the setup guide I wish I had when I started. In it, I am going to share <strong>everything you need to setup a training pipeline for SNeRG on AWS EC 2, </strong>so you can easily start running your own experiments.</p><p><em>Note: because this blog is specifically aimed towards those</em><strong><em> new to AWS, </em></strong><em>I’ll also share bits of info that should be helpful for setting up AI experiments in general on the platform.</em></p><h4>Why AWS?</h4><p>Let’s be real for a moment: SNeRG is a <strong>large </strong>neural network. For most of you, trying to train it on your own laptop will take you until at least a week (and I am <em>not</em> exaggerating). Who has time for that?</p><p>Therefore, let’s set up our training on<a href="https://aws.com/"> Amazon Web Services, aka AWS</a>. It’s is a popular <strong>cloud computing platform, </strong>which means you get to use other people’s computers — for us today, that means using <em>graphical processing units </em>(aka GPUs) — for running your machine learning workloads. While it is not free to use, in my experience it was well worth it to not have to go out and buy all the GPUs that are otherwise needed on my own. The process is fairly straightforward, albeit some steps (which I’ve marked with <strong>***</strong>) are more involved than others:</p><p><strong>Enter AWS</strong></p><ol><li>Sign up at <a href="https://aws.amazon.com/">https://aws.amazon.com</a>. You’ll need a credit card ready, although you’re not charged for anything upfront.</li><li>Choose <strong>EC 2, </strong>from under the “Services” dropdown menu (located in the top left): this is where we’ll select the type of computer hardware accelerators (which are also called “Instances” in the AWS documentation) to run our training. <em>Note:</em> AWS has another service called SageMaker to setup machine learning — but for now we’ll focus on EC 2, since it’s cheaper :).</li><li>On the next page, click on “Launch Instances” — it’s the big orange button in the top right.</li></ol><p><strong>Get Ready to Launch! <br></strong>You should be on a screen that prompts you to “Choose an Amazon Machine Image (AMI).” It sounds like a mouthful, but all this “image” does is tell the EC 2 instance (that we’ll choose in a later step) exactly how we want to setup our server.</p><p><em>Why this is cool</em>: with an AMI, now we don’t need to manually setup the instance ourselves! Basically, the AMI acts like a list of instructions to the EC 2 instance — it tells it exactly what kinds of <em>environment </em>(which refers to the various software packages, device drivers, and any other dependencies we might need) when training our AI algorithm. Personally, I feel it might be more appropiate to call it a <em>recipe</em> than an <em>image!</em></p><ol><li>AWS offers several, special kinds of AMIs that are specifically for training deep learning models — these <em>Deep Learning AMIs </em>(DLAMIs) are what we’ll use today. Search for <strong>“Deep Learning” </strong>and then you’ll see several of these options. While any of these could work, in my experience the <strong>Deep Learning AMI (Amazon Linux 2) </strong>is the best. <em>Note that the the version of this DLAMI I used time of writing this was 60 — but AWS does update fairly often.</em></li></ol><p><strong>***Getting a GPU Instance***</strong></p><p>Now<strong>, </strong>we<strong> </strong>need to <a href="https://docs.aws.amazon.com/dlami/latest/devguide/gpu.html">choose the right instance type</a> for the job. Just like a hammer can’t unscrew a nail, we need to choose an instance type that will make it as easy as possible to run our neural network on the DLAMI environment. For the majority of you who are using DLAMIs on AWS for the first time, I would suggest choosing the <strong>g3s.xlarge </strong>instance type.</p><p>But there’s actually one problem we need to fix before we can request a g3s.xlarge, or any other GPU instance: by default, AWS does <strong>not </strong>allow new users to request it when they first sign up for the service. This is because the g3s.xlarge is, well, a <strong>very</strong> <strong>large, </strong>non-free-tier instance — it actually takes up to 4 virtual CPUs to run under the hood. And as a new user you’re only allowed to take up 0. Ideally, this restriction helps new AWS users avoid paying for server time than they actually need, and paying more as a result.</p><p>Fortunately, for our purposes we can request a <strong>limit increase </strong>so you can get your hands dirty with model training:</p><ol><li>Head over to this URL (fill in the variables with your own AWS region, e.g. “us-east-1”), to open a new support case in AWS:</li></ol><pre>https://&lt;your-aws-region&gt;.console.aws.amazon.com/support/home?region=&lt;your-aws-region&gt;&amp;skipRegion=true#/case/create?issueType=service-limit-increase&amp;limitType=service-code-ec2-instances&amp;serviceLimitIncreaseType=ec2-instances&amp;type=service_limit_increase</pre><p>2. Be sure to fill out the form accurately — for “Primary Instance Type”, you can select “All G instances.” The description doesn’t need to be long (but keep in mind, real people answer these requests).</p><p>You may need to wait a day or two for someone get back to you. This is hard, but try to be patient — believe me, I’m sure someday in 5 years we’ll all look back to today and laugh about how long this process used to be :).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ca5_ap_msJs-e_8cGEoqsQ.jpeg" /><figcaption>Waiting is a also good opportunity to catch up on sleep. 😴 Photo by <a href="https://unsplash.com/@jwwhitt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jordan Whitt</a> on <a href="https://unsplash.com/s/photos/nap?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><p><strong>3. Once you’re request is approved,</strong> we’re ready to roll! Follow the steps above to select the DLAMI again, whichever one you’ll be using for this instance. On the next page, you should see a LONG list of instance types. The g3s.xlarge is pretty far down in the list, so I would recommend using a Cmd+F search (or Ctrl+F on Windows) to jump down to the row that has it, and then click the checkbox at the very left.</p><p>4. For now we don’t need to get too caught up in additional configuration details (but you can watch this <a href="https://youtu.be/WNfFD1MSj44">video by Jeff Heaton</a> where he shares plenty of useful advice on that if you’re interested). Otherwise, you can click the blue “Review and Launch” button at the bottom, and (at last) turn on the instance!</p><p>5. The final step is to actually login (or “connect”) to your EC 2 instance. Obviously we can’t go to an AWS data center to do this in-person — instead, we’ll be using an SSH tunnel. For those of you on macOS, I’d recommend following along with this <a href="https://www.youtube.com/watch?v=HIs3RWDI4a8">video by Pythoholic</a> to learn how to do so. For those of you on Windows, the Jeff Heaton video I linked above should provide a great explanation.</p><h3>Your First SNeRG</h3><p>If I’ve done my job well, you should now have sufficient computing power needed to train powerful neural networks like SNeRG in just a few hours.</p><p>To run such an experiment though, we still need to do a few steps inside the actual EC 2 instance:</p><ol><li>Clone the source code for the SNeRG algorithm</li><li>Configure your environment (in terms of install Python dependencies, setting environment variables, etc.)</li><li>Pull in a dataset of training/test images</li><li>Running the train.py script (which the author of SNeRG was kind enough to include in the GitHub repo!)</li></ol><p>This process can get fairly involved — so as an example of how to do it, I’ve provided the following commands for you to run inside your EC 2 instance. This will use the run SNeRG on the <strong>demo</strong> dataset, provided by the SNeRG authors:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dc1b3cca391a2eb1ec5712a7204aaa0/href">https://medium.com/media/9dc1b3cca391a2eb1ec5712a7204aaa0/href</a></iframe><p>Please see the the README file of the <a href="https://github.com/google-research/google-research/tree/master/snerg">SNeRG GitHub repo</a> if you’re curious about how this source code actually functions. There’s a lot in there, so I personally would say it’s a good way to get exposure to more advanced Python syntax and computer graphics concepts :)</p><p><em>Last but not least — to </em><strong><em>keep your costs down</em></strong><em>, please be sure to switch your EC 2 instance to the “Stop” state when you’re done playing around with it!</em></p><h3>Part 1 Conclusion</h3><p>Booyah! You’ve just taken another step to becoming an AI scientist. To summarize, if you understood this content well you now have the tools to:</p><ol><li>Setup GPU instances on AWS EC 2, and with an appropiate DLAMI</li><li>Connect to a EC 2 instance remotely, using an SSH connection</li><li>The sequence of commands you can run to train SNeRG</li></ol><p>If I’ve piqued your curiosity, feel free to leave a comment on this post and I can answer any questions you have, or make a follow up blog on anything you want to see expanded on, e.g. how to setup a SNeRG experiment with your own <strong>custom dataset, </strong>logging metrics in TensorBoard, etc. Otherwise, happy SNeRG’in!</p><h3>References</h3><p><a href="https://phog.github.io/snerg/">[</a>1] P. Hedman, P. P. Srinivasan, B. Mildenhall, J. T. Barron, and P. Debevec, “<a href="http://arxiv.org/abs/2103.14645">Baking Neural Radiance Fields for Real-Time View Synthesis</a>,” <em>ArXiv210314645 Cs</em>, Mar. 2021, Accessed: Feb. 17, 2022. [Online]. Available: <a href="http://arxiv.org/abs/2103.14645">http://arxiv.org/abs/2103.14645</a>.</p><p><a href="https://phog.github.io/snerg/">[</a>2] P. Hedman,<a href="https://phog.github.io/snerg/"> “Baking Neural Radiance Fields for Real-Time View Synthesis,</a>” <em>Project page for Baking Neural Radiance Fields for Real-Time View Synthesis.</em>, 2021. https://nerf.live (accessed Apr. 06, 2022).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5024081d68be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Mistakes to Avoid When Looking for Your First Machine Learning Role]]></title>
            <link>https://zain-raza.medium.com/3-mistakes-to-avoid-when-looking-for-your-first-machine-learning-role-a7810580ef93?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7810580ef93</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[new-grad]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 00:58:56 GMT</pubDate>
            <atom:updated>2022-02-09T00:00:23.175Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>3 Mistakes to Avoid When Landing Your First Machine Learning Engineer Role</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-V00wI5IVgiFThRF-xuug.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@aleksandarjason?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Aleksandar Jason</a> on <a href="https://unsplash.com/s/photos/looking%20out?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><h3>And What to Do Instead</h3><p>Picture this: you’re lying in bed, it’s nine o’clock at night and all the lights in your room are off. You’re trying to sleep, but tossing over left and right. It’s the night before your job interview — you want to sleep, but you just can’t, and for some reason you’re unable to shake off the voice of one incessant interviewer in your head, asking you over and over:</p><p><em>“How would you explain linear regression to a five-year old?”</em></p><p><strong>Let’s face it, searching for a job</strong> — even one as exciting as a Machine Learning Engineer —<strong> has its ups and downs</strong>. For someone with a nontraditional background (in my case, having gone to an innovative college called <a href="https://makeschool.org/">Make School</a> rather than a traditional university), you’ll face some things in the interview process that you might not have planned for at all.</p><p>I’m writing this to you because although I have not (yet) successfully landed my first full-time, professional role as an ML Engineer, I’ve come close on several occasions. After much reflection,<strong> I have three takeaways to share with you today, so you can make it easier on yourself to land that role.</strong></p><p>To make sure this is worth your time: here’s a list of all the pieces of advice I’m NOT going to go over in this blog, because I’m sure you’ve heard it before:</p><ol><li>Understanding the conceptual foundations of Machine Learning</li><li>Having practical experience through research, OSS, internships in industry,</li><li>Networking!</li><li>Seeking out a coach who can calm your nerves and guide your focus, and/or</li><li>Doing mock interviews to become more confident before the real thing.</li></ol><p>If you’d like to go beyond this advice (which is not to say it’s not legitimately valuable, and you <strong>should</strong> probably spend 80% of your time on this), then let’s get started.</p><h3>The Mistakes</h3><h4>#1: The Solutions You Give Are Too Complicated</h4><p>This lesson took me a painfully long time to learn. About 2.5 months ago I interviewed with an AI team at a FAANG company, which was working on a personal assistant I won’t name (but I’m sure you’ve heard of before). One of their key features was to make sure the assistant gave notifications to users at regular intervals during the week, matching the time of the notification to the time of day they usually check-in that respective app (e.g. getting pinged at 7AM everyday, so you can check the schedule of yoga classes in your area). What was their interview question to me, you might ask?</p><p><em>“So, how would you go about building a recommender system for this feature?”</em></p><p>This memory still stings me: the truth is, at this point I had no idea what a recommender system was. That itself wasn’t the problem — the problem was the next thing I did was blurt out something that confused the interviewer (and myself, to be honest). Here’s a paraphrasing of how it went:</p><p><em>“Oh, well sure! Let me see… well, why don’t we make a bot, that could be used to understand ALL of a user’s habits, and using a convolutional function to predict when the user needs to see a specific notification…”</em></p><figure><img alt="A small robot lost in a parking lot, out in the middle of nowhere." src="https://cdn-images-1.medium.com/max/1024/1*IY7gUahoaGir0V8K_gknzg.jpeg" /><figcaption>This is exaggerated, but even the smartest robots get lost sometimes. Photo by <a href="https://unsplash.com/@neonbrand?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">NeONBRAND</a> on <a href="https://unsplash.com/s/photos/bot?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><p>This is exaggerated, but the point is the same: <strong>the interview is the place to keep things clear, and clear communication is simple communication. </strong>One of the best things I do now when I get stuck in interviews is to simply ask: ask for a hint, ask for a different question, or a simpler version of the one you have. It’s in the interviewer’s best interest to help you succeed, so trust me that this is not as crazy as you might think!</p><p><strong>Enter Recommender Systems</strong></p><p>As a side note — for anyone who is looking for a great introduction to recommender systems (with code), I highly recommend this <a href="https://www.kaggle.com/gspmoreira/recommender-systems-in-python-101">“Recommender Systems in Python 101</a>” Kaggle notebook by Gabriel Moreira.</p><h4>#2: The Code You Write is Too Slow</h4><p>Maybe you read this and think, “well, isn’t Python supposed to be slow? What I can do about that?”</p><p>The problem here is, you’re actually right (and wrong) about Python.</p><p>Let me explain: in another interview process, I was given a take-home assessment by a computer vision startup, and asked to write a foundational algorithm (which I guarantee you’ve heard of if you’ve studied computer vision) f<em>rom scratch</em> in Python. After 7–8 hours of focused work, I did what I thought was the best job I could, and submitted it.</p><p>I lost that opportunity. And what did the feedback say?</p><p><em>“It could’ve been optimized more.”</em></p><p>This is the point where we either 1) pull our hair out, or 2) learn more about <em>vectorization </em>(and I recommend the second option). What are interviewers really looking for in optimized code?</p><p>The truth is, many things. As you might’ve already guessed, Python is indeed slow, in that it needs to be interpreted before it is compiled. <em>But, </em>that doesn’t mean we have to settle. How so?</p><p><strong>Enter Vectorization</strong></p><p>If you haven’t learned about how to <em>vectorize </em>your code yet and you want to get into machine learning (especially with respect to deep neural networks), now is the time to start doing so. <em>Vectorization </em>is a programming technique that allows your machine to run your code faster, by running instructions in parallel (as opposed to one at a time). This can <em>dramatically </em>speed up execution!</p><p>The best part about vectorization is although it sounds complicated, it’s easy for your interviewer to notice you’re doing it: for example, I recommend just using more of the functions built into the NumPy API, instead of your own. Like the gift that keeps on giving, vectorized code is also typically <em>shorter </em>than regular Python, because you’ll no longer need to explictly write out long for loops and such. Let’s look at an example: below, I have a function that projects a set of vectors from 1 plane to another in 3-dimensions (as explained by <a href="https://stackoverflow.com/questions/55226011/using-python-to-calculate-vector-projection">AGN Gazer on Stack Overflow)</a>. I’ll show you how it looks like un-vectorized (aka, with a for loop), and then again using NumPy functions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48e6b60d59c1e3e7b674cecdf54b4bd6/href">https://medium.com/media/48e6b60d59c1e3e7b674cecdf54b4bd6/href</a></iframe><p>The bottom line: vectorization makes code faster and shorter, and it’s one of the things that helps your Python code stand out.</p><p>If you’re looking for an introduction to NumPy for free, I would definitely invite you to try <a href="https://cs231n.github.io/python-numpy-tutorial/">Stanford’s introductory tutorial</a> for it, as part of their CS231n class. For a more in-depth look at vectorization specially, I highly suggest taking <a href="https://www.coursera.org/learn/neural-networks-deep-learning">Andrew Ng’s “Neural Networks and Deep Learning” class</a> on Coursera.</p><h4>#3: Have You Thought About OOP?</h4><p>On every team software project I’ve ever worked on, there was always at least 1 person whom I call “the nanny” — that’s the person concerned about code quality.</p><p>For many of us who are just starting out, we tend to moan and groan about nannies. Why? Because up to this point, our software projects have mostly lasted on the duration of <em>days</em> and <em>weeks</em>. You build something to learn a language X, then next week it’s framework Y, or a new command called Z, etc. If the code quality is messy or hard to follow, it’s not a big deal. You move on.</p><p>However when you’re interviewing at a company, <strong>your job is to please the nanny.</strong> The bar for code quality is higher, because they need to evaluate how you’re going to impact the team’s codebase for the <em>months</em> and <em>years </em>to come ahead. And one of the things that stands out as well-designed, high-quality code is incorporating the use of object-oriented programming.</p><p>This isn’t always needed — like mistake #2, this is mainly in the context of standing out on take-home assessments, and particularly when you’re not allowed to use libraries (aka, you’ll be building algorithms from scratch). For example, let’s say an AI company gives you the following challenges:</p><ol><li>Fit a polynomial to a set of XY points <em>(without outside libraries)</em>.</li><li>Fit a polynomial to a set of XY points, and make the model robust to outliers <em>(without outside libraries)</em></li><li>Fit a plane to a set of XYZ points <em>(without outside libraries)</em></li></ol><p>What’s the real challenge with this assessment? For me in the beginning, it was just avoiding the trap of getting lost in my own code. I didn’t realize all the time I spent using the popular frameworks (e.g. Keras, Scikit-learn) actually trained my brain to go on autopilot on my machine learning projects.</p><p>To prevent falling into this trap, I would invite you to <strong>not </strong>start coding right away. If you do, it’s alot like mistake #1, where you’re likely to go with something that doesn’t work and is hard to explain. Instead, what you might want to do is <strong>scope</strong> out the problem: identify the right places to reuse code, and then build the right helper methods and classes. Continuing with this example, here’s what I might write in a util package in my project:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29284218fb2cb13d9618bf01466de065/href">https://medium.com/media/29284218fb2cb13d9618bf01466de065/href</a></iframe><p>I encourage you to take a moment to walk through this code, and see what you like/dislike about it. Here are some questions for starters:</p><ul><li>Do I know what this is doing?</li><li>Is it easy to understand?</li><li>Where would I want to use this? How much would this give me “out of the box” to go do that thing?</li></ul><p>This should hopefully give you a good chance to reflect on your own coding style, and to start evolving from a developer who’s merely comfortable with using other people’s libraries (e.g. Scikit-learn, Keras, PyTorch, etc.) to one that your team could rely upon to build their <em>own</em> internal API from scratch.</p><p>It might be alot of work, but believe me it sends the right signal — on multiple occasions, I’ve received compliments from managers at companies about my code. If you’re interested for more tips on passing take-home assessments for software engineers, I recommend this other great blog by <a href="https://www.freecodecamp.org/news/the-essential-guide-to-take-home-coding-challenges-a0e746220dd7/">Jane Philipps on freeCodeCamp.</a></p><h3>Conclusion</h3><p><strong>Like I said, searching for a job</strong> — even one as exciting as a Machine Learning Engineer — <strong>has its ups and downs</strong>. How do you justify putting yourself through all that?</p><p>Frankly speaking, I think every person discovers (and if you’re like me, you <em>occasionally</em> lose and rediscover) a personal answer to that question. In my own example, as I write this I can’t help but think of what AI could eventually do for us all.</p><p>Imagine this: one hundred and fifty years ago, almost no one had light bulbs in their home. Then in 1882, Thomas Edison turned on the first commercial power station ever in New York City, changing everything. Now fast-forward to today: all our homes, biomedical devices, and even the device you’re reading this on wouldn’t be possible without the grid. And suddenly, now <em>“AI is the new electricity”</em>, or so says Dr. Andrew Ng of Stanford.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vzSNO6T1OekXBdjN-8_ZjQ.jpeg" /><figcaption>ML Engineers: we are trying to become the Edisons of our time. Photo by <a href="https://unsplash.com/@aindraus?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Anthony Indraus</a> on <a href="https://unsplash.com/s/photos/electric-lights?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><p>Why does this matter? For most of us, 1882 is a distant memory. But every ML Engineer I’ve ever met, every AI company I’ve interviewed with, reminds me <strong>we</strong> <strong>are</strong> <strong>trying to become the Edisons of our time. </strong>Before we get to change the world though, we need to get great experience. So… why wouldn’t that be challenging?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7810580ef93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Make Data Science Easier (for Students!)]]></title>
            <link>https://blog.devgenius.io/how-to-make-data-science-easier-for-students-dcea7a8829a5?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcea7a8829a5</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[multimodal-learning]]></category>
            <category><![CDATA[active-learning]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 01:53:13 GMT</pubDate>
            <atom:updated>2021-08-30T07:39:29.029Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introducing the Python Literacy Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*inpgOWU_2XuG5VrYeW1o_g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@adamaszczos?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Adam Nowakowski</a> on <a href="https://unsplash.com/s/photos/data-science?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>How Most of Us Learn</h4><p>Many of us feel that as students, we learn best when the teacher’s content matches our learning style. How does this factor into how we learn data science?</p><p>Today as a machine learning engineer, I know I can sometimes look at the growth of this field in recent years and forget what it’s like to be starting out: so I sat down with an incoming junior majoring in Data Science in her undergrad (let’s call her “Abby”), and interviewed her about her experience. One of the first things Abby told me was that “I’ve always been analytical. Observant.” As you might expect my interviewee went on to mention this is what led her study Data Science, so she can go deeper into doing data analysis in areas like meterology, or business intelligence.</p><p>At first glance, I thought my interviewee had found the perfect fit in choosing Data Science, and would have a smooth ride in her career. In fact, Abby had even completed a summer job as a Data Analytics and Business Intelligence Analyst Intern at PTC recently, so I went on to ask what her experience there had been like.</p><p>But before I tell you what she said, here’s another story that might surprise you…</p><h4>What Kind of Learner Are You?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I76453UlCbLScR0x3NMy4w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@rohanmakhecha?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Rohan Makhecha</a> on <a href="https://unsplash.com/s/photos/question?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>It’s a sunny day in downtown Los Angeles. A man is standing on a busy street corner just outside of a mall. Dressed in a casual black t-shirt and jeans, he’s conducting a social<em> </em>experiment with the passerby pedestrians.</p><p>He stops people who are on their way to the store, and asks a simple question.</p><p>“What kind of learner of you?”</p><p>Most people reply “visual.” Others say “auditory”, or “I learn best from reading blogs”. One person even says that to him, learning is a “contact sport”, and that therefore he learns best when doing something with his hands.</p><p><a href="https://youtu.be/rhgwIhB58PA">This is not a fictional tale</a>: this social experiment (which admittedly wasn’t conducted with the scientific rigor of educational research) was actually conducted this past July by Derek Muller, the well-known science educator and creator behind the popular YouTube channel <a href="https://www.youtube.com/channel/UCHnyfMqiRRG1u-2MsSQLbXA">Veritasium</a>. And what does Muller eventually demonstrate in his video?</p><p><em>Tailoring to a person’s learning styles don’t really improve their education! </em>After asking people for their learning style, Muller then administered a short memory test to each of his participants, and divided it up by learning style: for half of the visual learners, he showed them ten images of different objects, and asked them to tell him what they saw. Then, for the <em>other </em>half of visual learners, he gave them the same test, but instead of showing the pictures he simply <em>spoke </em>the names of the objects he had. At the end of the day both groups of people did not outperform the other significantly, despite one group receiving the test in a way that matched their learning style. <a href="https://youtu.be/rhgwIhB58PA?t=575">In his video</a> and in the description, Muller also cites review articles of learning styles that support this finding.</p><p>So if finding the right fit for your learning style and/or interests <strong>is not</strong> what helps us succeed as students, what is?</p><h3>Rethinking the Learning Journey</h3><p>Let’s go back to Abby— she told me that while very interested and dedicated to her field, she indeed faced many technical challenges, particular in programming with Python to make data visualizations on the job.</p><p>The following list contains some of her go-to strategies for getting unstuck when she faced problems while coding, and I have no doubt many data science students and machine learning engineers will relate:</p><ul><li>going to Stack Overflow,</li><li>Switching to another analytics tool for some tasks such as Tableau or Qlik Sense</li><li>and getting help from instructors or colleagues</li></ul><h4>What’s Missing Here?</h4><p>To be clear, none of these strategies are problematic! I’m sure many data scientists and engineers who read this will relate, and would say this is just part of the process that results from moving out of the classroom, to using your skills in the real world. Going further with what Abby said, <em>this</em> is what struck me as the problem<em>:</em></p><p>Her biggest challenge was not just knowing <strong>what</strong> steps to take as she was coding, but <strong>how </strong>to determine what part of her code wasn’t broken. Was it the library she was using? The syntax of the code? Were the errors due to misapplying the conceptual knowledge she had learned in class? Not being able to figure out can make someone feel lost while coding. I believe giving students the tools to solve these questions will not only make data science education more like what students see in the real world of research and industry; it’s a path to a lifetime of more productive work and fulfilling careers.</p><h3>The Active Learning Paradigm</h3><p>I have to be transparent with you: I still consider myself a student of data science, and I too want to figure out how to better apply the information I learn in class, to solving real-world problems. So I selfishly ask myself: is there <em>anything </em>that can help us build this skill better?</p><p>The best answer I’ve found so far is more nuanced than I would’ve expected. Let’s revisit Derek Muller. While <a href="https://youtu.be/rhgwIhB58PA">his video</a> does demonstrate that pigeon-holing people as “visual” learners or not doesn’t truly indicate how well they would respond to visual learning content, he ends his social experiment with one more trial: he gives the same memory test to his participants, to assess how well they can remember the list of objects he has. Except this time, he shows the objects using <em>multiple</em> forms of content at once: he shows the picture, <em>and </em>provides a text label underneath it, <em>and</em> simultaneously says the name of the object (e.g. “candle”, “duck”, “heart”, etc.) for the participant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b7h8SAbdePJbrMeUWur_rQ.png" /><figcaption>Derek Muller in <a href="https://youtu.be/rhgwIhB58PA">“The Biggest Myth in Education”</a> (2021).</figcaption></figure><p>The result? All the participants did better on the memory test. Muller explains in the video that what he believes improves learning is not the specific content, but “what is happening inside the learner’s head” (Muller, <a href="https://youtu.be/rhgwIhB58PA">“The Biggest Myth In Education”</a>).</p><p>In other words, the goal is helping students do <em>active learning</em>, and it’s an idea I want to help bring more into the world of Data Science education.</p><ul><li>Tired of boring passages in textbooks? Let’s use<strong> more relevant examples.</strong></li><li>Do the problem sets make no sense? Time for <strong>more relevant exercises.</strong></li><li>Does the content “just not make sense?” Let’s try <strong>combined modes of communication</strong>, with words and text and audio, rather than sticking to only one or two.</li></ul><h3>Meet the Python Literacy Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zUqsJmJ4XpCr7cRNce0jmg.jpeg" /></figure><p>Data science is a rapidly growing field, and the community is only growing: on the <a href="https://insights.stackoverflow.com/survey/2021?_ga=2.236209345.190202062.1628102352-126161871.1625855113#section-most-popular-technologies-other-frameworks-and-libraries">Stack Overflow 2021 Developer Survey,</a> the Python data science libraries such as NumPy and Pandas were some of the highest-ranking in tools that respondents said they loved working with, and wanted to continue using.</p><p>If you have made it this far, the chances are you are also a part of this passionate community as well, and care about making data science education better. If so, I cordially invite you to check out the GitHub repository for the “<a href="https://github.com/UPstartDeveloper/Python-Literacy-Project">Python Literacy Project</a>”, an open-source project I started with my professor Milad Toutounchian of <a href="https://www.linkedin.com/in/milad-amir-toutounchian-84508128/">Drexel University</a> to collect all the best examples and exercises to help students actively learn Python programming for data science. We hope to one day include some of these materials in a new e-textbook tenatively titled <em>Data Science Fundamentals with the Active Learning Paradigm. </em>More importantly I’m excited to garner feedback from the community on the content we have in the project so far, and to use open-source as a way to lift up everyone trying to learn data science!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcea7a8829a5" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/how-to-make-data-science-easier-for-students-dcea7a8829a5">How to Make Data Science Easier (for Students!)</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Software Development Intern’s Survival Guide]]></title>
            <link>https://zain-raza.medium.com/the-software-development-interns-survival-guide-384150e23333?source=rss-b9c6a8cd1b33------2</link>
            <guid isPermaLink="false">https://medium.com/p/384150e23333</guid>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Zain Raza]]></dc:creator>
            <pubDate>Fri, 13 Aug 2021 23:23:20 GMT</pubDate>
            <atom:updated>2021-08-16T13:53:44.270Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to Make The Most of Your First Internship in Tech</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gvoawu6jmZ9Xrioi1J_WNA.jpeg" /><figcaption>You’ve made it my friend. Photo by <a href="https://unsplash.com/@linkedinsalesnavigator?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">LinkedIn Sales Solutions</a> on <a href="https://unsplash.com/@linkedinsalesnavigator?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><p>You’ve made it my friend.</p><p>If you’re reading this blog, the chances are you’re about to go into your first internship in software development. Congratulations!</p><p>My intention in this post is to let you know what has and hasn’t worked for me in the past when I was in your shoes, and to give advice that can hopefully <strong>guide you to more success in your new role</strong>.</p><p>For background, I am about to wrap up my software development internship for this summer, at <a href="https://ptc.com/">PTC</a>. My aim here is to give advice that’s company-neutral though, and by the end I believe you’ll have a better idea of just what exactly you can utilize this opportunity for, and how to use it to accelerate your career.</p><h3>Part I: Before the Internship Starts</h3><h4>Advice to My Former Self</h4><p>In a lot of ways, starting a new internship can be an exhilarating period in your life — but for me, I remembering feeling exhausted, and throughout my orientation at PTC I felt oddly disconnected from my peers when I first began working. How could this have been possible, you may ask?</p><p>If you had asked me then, I would’ve told you I just didn’t feel passionate about PTC. Thankfully I had an advisor who passed along advice to me from the book <em>So Good They Can’t Ignore You </em>(2012), by Professor Cal Newport of Georgetown University. This book shocked me —here’s one of my favorite quotes from Newport on the subject:</p><blockquote><em>“</em><strong><em>Passion</em></strong><em> comes </em><strong><em>after</em></strong><em> you put in the </em><strong><em>hard work</em></strong><em> to become excellent at something valuable, </em><strong><em>not before</em></strong><em>. In other words</em>, what you do for a living is much less important than how you do it.” — <em>Cal Newport</em>, So Good They Can’t Ignore You<em> </em>(2012)</blockquote><p>If I could back in time to my former self, I’d tell him to <strong>worry more about having a lack of <em>patience</em>, than a lack of passio</strong>n. In my case, I thought PTC was boring just because its products — SaaS software that helps global industrial manufacturers be more productive — was hidden from my view as an everyday college student. Therefore, I prematurely wrote it off as a boring, lackluster place to work.</p><p>Through personal reflection and more advice from mentors, I eventually became aware that this was holding me back. I now believe the solution to this problem is to <strong>get in learning mode.</strong></p><p>If you’re looking towards starting your first internship in tech, <strong>here are 3 things I would suggest you to do right now:</strong></p><ol><li>Follow the company on social media.</li><li>Sign up for any networking events hosted by the company.</li><li><strong>Search for the company on GitHub</strong>. As a developer, it’s additionally helpful for you to learn the company’s technologies and to get involved in any open-source projects they have open.</li></ol><p><strong>Ultimately, remember the greatest thing about an internship is it’s only temporary. </strong><em>You and the work you do matter</em>, and if the company has done its part well, your internship will most likely be full of opportunities to invest in long term growth. For your part, my best advice is to immerse yourself in <em>the company’s ideas</em>, and what <em>your coworkers are passionate about </em>during , and I believe you will be much better off in eventually figuring out what this internship will mean for your career, rather than trying to decide those things before you’ve gotten your hands dirty in the actual work.</p><p>In my case, I believe I am passionate about using technology to build a sustainable world. PTC hasn’t changed that part of my identity, but deepened it. My evaluation for how exciting the company is now is much mature, since I can see the products that PTC creates (again, digital tools that support global industrial manufacturers) would drive forward the kind of world I want to live in: one where our devices, home appliances, clothing, (and just about anything else that is made by humans that you can think of) would contribute to making the world carbon-neutral by 2030.</p><p>Lastly, keep in mind alot of companies will illustrate their vision very tangibly through social media and events (see this <a href="https://twitter.com/PTC_Windchill/status/1400123358965121026?s=20">Tweet from my business group in PTC</a> for an example). So please consider following them there as well!</p><h3>Windchill, a PTC Technology on Twitter: &quot;In our two-day virtual event learn how to create a solid foundation for enterprise #PLM. Register now to engage with speakers in live Q&amp;A and asks the Experts forum! #DigitalThread https://t.co/G3nkvzMZ7W pic.twitter.com/njil7bCiHQ / Twitter&quot;</h3><p>In our two-day virtual event learn how to create a solid foundation for enterprise #PLM. Register now to engage with speakers in live Q&amp;A and asks the Experts forum! #DigitalThread https://t.co/G3nkvzMZ7W pic.twitter.com/njil7bCiHQ</p><h3>Part II: The Onboarding — How to Get it Right!</h3><p>So what does it take to successfully onboard a company?</p><p>It’s more than just getting your work laptop on time. It’s more than making sure you know how to fill out your time cards to get paid on time (although that is important as well!). <strong>This is where we as interns can set up good habits for success for the length of the internship, if not longer. </strong>Here are a two examples from my PTC internship:</p><h4>Forced Q&amp;A Time 🗣❓</h4><p>Speaking for myself, I felt absolutely lost the first few weeks on the job. No idea on how to set up my developer machine, and working in a completely new language made a major dent in my self-confidence. I realized I needed to ask more questions of the senior engineers on the team, but couldn’t find the time either because of 1) thinking they were too busy with other meetings, or 2) falsely thinking if I just “worked harder” on the problem that I would find the answer, and 3) I didn’t want to look dumb. Eventually, my solution was to set a daily reminder on my own calendar, that was at the same time each work day, where I would be reminded that I had to go and ask my senior engineers for their input on the development issues I was facing. The best part of this is (contrary to my fears) they <em>never </em>took my asking questions as a sign of lower intelligence. The blessing here is that I not only was able to work more productively, but I surprised myself at a midsummer performance review with my manager, who told me one of the best pieces of feedback he’d received about me was that I asked intelligent questions!</p><h4>Make Time for Networking</h4><p>Within the first three weeks of my internship, one of the first pieces of critical feedback I received from my manager was that I wasn’t making it to the intern-specific meetings set at PTC. I remembering feeling shocked — “<em>say</em> <em>whaaat? how in the world can that relate to the project I’m doing for the team?”, </em>I remember thinking to myself.</p><p>However, I realized that sentiment could not be further from reality. According to <a href="https://blog.hubspot.com/sales/face-to-face-networking-stats">HubSpot</a>, “68% of entry-level professionals value face-to-face networking more than online”, so it became important to me to make it to these events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UeV8plg0f8RZpqNfIWBijw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@rohankrishnann?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Rohan</a> on <a href="https://unsplash.com/s/photos/calendar?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I recommend if you find yourself in a similar situation, try looking at your calendar every night, for the day after — see if you have any networking events scheduled. Just as with many soft skills, my networking improved when I simply became more aware, and I believe this increased my preparation dramatically, both in showing up (albeit over a Teams call) but also getting ready to use common conversation starters to the people I met, such as <a href="https://youtu.be/Cbyc7mscFlA">these</a> I would recommend to you as well.</p><h3>Part III: Learning All the Way</h3><p>After a few weeks, I can almost guarantee you will notice yourself beginning to settle into your internship. For me, this is a scary thought: neuroscience tells us that the act of learning strengthens the mind just as lifting weights strengthens the body. That means we must continue learning all the time—therefore, here’s a topic I went out and learned in my free time during my internship, which I believe will benefit you as well:</p><h4>Software Architectures for Distributed Systems</h4><p>Here’s food for thought: in 1986, my mother (who was then Head Girl in her high school) was appointed as the school librarian. As you might expect, she tells me today that the experience taught her many skills — organizational skills, cataloguing skills, skills in nagging people to return their books on time, and the list goes on and on.</p><p>Fast-forward thity-five years: it’s 2021, and tech companies have made <a href="https://www.theguardian.com/commentisfree/2016/dec/22/libraries-dying-books-internet">libraries all but a rare artifact of the past</a>. Why? Because today instead of going to library to find evidence that vaccines work, or to casually research different ways to solve the “Fizz Buzz” problem in Python<em>, </em>I can find those answers with just a simple search on Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSEePtBQ5Zwgfupi2dQTAw.jpeg" /><figcaption>Software architects plan, prepare, and aid in implementing apps that can be spread across multiple different machines, and become accessible to people all around the world. Photo by <a href="https://unsplash.com/@ianjbattaglia?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ian Battaglia</a> on <a href="https://unsplash.com/s/photos/servers?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>This is hugely in part thanks to advancements in <em>software architecture</em>, which is how engineering teams can plan, prepare, and implement scalable applications that can be easily used by billions of people around the world.</p><p>Software architects play a huge role in tech companies today. They take responsibility for planning, preparing, and aiding developers in implementing apps that can be spread across multiple different machines — as a result, the combined computing power of all these different machines is what makes these kinds of apps possible. As an intern, you may not be expected to take on these responsibilites just yet — but it is truly a part of what separates the “grunt programmers” from bona fide engineering leaders! Here are a few resources I would recommend you to get your feet wet in this topic, so eventually you too can participate (and someday <em>lead</em>) architecture lessons at your engineering organization if you so choose:</p><ul><li>“Four Distributed Systems Architectural Patterns by Tim Berglund” (<a href="https://youtu.be/BO761Fj6HH8">free lecture</a>)</li><li><em>Software Architecture Foundations, </em>by Allen Holub (<a href="https://www.linkedin.com/learning-login/share?account=76815018&amp;forceAccount=false&amp;redirect=https%3A%2F%2Fwww.linkedin.com%2Flearning%2Fsoftware-architecture-foundations%3Ftrk%3Dshare_ent_url%26shareId%3DypEKHlrWT5y9dHM%252BVHFVIQ%253D%253D">LinkedIn Learning course</a>)</li></ul><h3>Part IV: Internship’s Over — Now What?</h3><p>On a final note, how do we approach coming to the end of our software development internship?</p><h4>Settle on a North Star</h4><p>Over the course of your internship, you’ll undoubtedly have learned how to improve your skills based on your manager’s wishes — but now what about your own goals? As the last week of my internship came to a close, I wrote down one commitment I believe I’ll keep to myself, to make sure in my next steps I will deeper into the domains of software development I am truly interested in:</p><blockquote>“I will become an expert in deep learning, and someday lead world-class teams pushing forward the state of human machine interactions.”</blockquote><p>Writing down this statement is not an end all, be all — but I believe it can act as a guide so you can being inspire to improve yourself in the months and years ahead in your career.</p><h4>Find your Kind</h4><p>Being an intern is not always easy — it’s not intuitive to always be pushing yourself to improve. It requires focus, both in mental energy and actually executing on the commitments we have for ourselves.</p><p>Before coming to PTC, I admittedly did not pay much attention to keeping up with my network. But one of the mentors I met on the internship, <a href="https://www.linkedin.com/in/varunmani/">Varun Mani</a>, gave me the advice to stay in touch with the connections I made over the summer. For context, this is a man who has done the impossible: he went from leaving his home country of India for college, to rubbing shoulders with <a href="https://youtu.be/nkm3HceFpQM">Alex Kipman of Microsoft’s HoloLens</a> just two years right out of school, to starting his own company and eventually getting acqui-hired at PTC as a VP of Advanced Research, and making the <a href="https://www.forbes.com/under30/list/2019/asia/enterprise-technology/#18e07e5269b0"><em>Forbes’ 30 Under 30</em></a> list in 2019. When I asked him what his secret was, here’s what he told me —</p><p>Just. Stay. In. Touch. Some of your coworkers very well may help you keep moving forward in the career ahead.</p><h4>Help Others Learn as Well</h4><p>In this blog, I’ve written a lot about learning. From your first days in orientation to the final goodbyes on your last day, you’ll have the opportunity to learn about how you interact with others. In the day to day, you’ll exercise the hard skills that got you hired for this role (and potentially many more to come). Lastly, after the internship is your chance to solidify what you’ve learned by helping others. Here are a few ideas to get started:</p><ul><li><strong>writing blogs</strong> (like I did to make this post!) on technical topics</li><li><strong>becoming a TA</strong> at your school</li><li>volunteering to <strong>mentor someone</strong></li></ul><h4>Closing Thoughts</h4><p>Admittedly, this is the part of my story that’s still being written as I tell you about it in this blog. However these are the ideas I believe will cultivate the fondest of memories in the future when you and I look back on our internship. If you can implement these into action as well, then I have just one last thing to tell you about your future:</p><p>Congratulations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=384150e23333" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>