<?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 Fatih Altınok on Medium]]></title>
        <description><![CDATA[Stories by Fatih Altınok on Medium]]></description>
        <link>https://medium.com/@frontsideair?source=rss-155954bb4ea9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k1q3ZKRBbJX7HuOar8JrOw.jpeg</url>
            <title>Stories by Fatih Altınok on Medium</title>
            <link>https://medium.com/@frontsideair?source=rss-155954bb4ea9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 11:18:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frontsideair/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[How to detect 3XX redirect responses in XHR]]></title>
            <link>https://medium.com/@frontsideair/how-to-detect-3xx-redirect-responses-in-xhr-fbc2500052f3?source=rss-155954bb4ea9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbc2500052f3</guid>
            <category><![CDATA[ajax]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[https]]></category>
            <dc:creator><![CDATA[Fatih Altınok]]></dc:creator>
            <pubDate>Fri, 22 Jan 2016 22:33:26 GMT</pubDate>
            <atom:updated>2016-01-22T22:33:26.364Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently stumbled upon a problem when I was exploring how to handle a corner case in our web app. For a special case, we were considering returning a 3XX status code to inform the client and handle the situation; but to our chagrin, it wasn’t working. We scrapped the whole idea, but here’s what I learned when we were investigating it.</p><p>If the request is made to the same origin, or the server has CORS enabled, the 3XX response is followed transparently; and the XHR handlers never know that this is the case until it gets an OK (2XX) or error (4XX/5XX). The error case is not important to us right now, but how do we determine we were redirected if the status code we receive isn’t 3XX?</p><p>I looked for an answer on the internet, but found none of them satisfactory. One common solution was too hacky for my tastes; the server was supposed to provide a special header in case it redirected (or didn’t) so the client would know; but fiddling with the server to make it work didn’t make sense to me, so we didn’t spend any time on it.</p><p>One solution I found but we didn’t use was this:</p><pre>var xhr = new XMLHttpRequest();<br>var url = &#39;/users&#39;;<br>xhr.open(&#39;GET&#39;, url, true);<br>xhr.onload = function() {<br>  if (xhr.status === 200) {<br>    if (xhr.responseURL === url) {<br>      console.log(&#39;got what we wanted, hooray!&#39;);<br>    }<br>    else {<br>      console.log(&#39;boo, we were redirected from&#39;, url, &#39;to&#39;, xhr.responseURL);<br>    }<br>  }<br>};<br>xhr.send();</pre><p>This works because when the request is redirected, the redirected page can be accessed from xhr.responseURL and any discrepancy between that and the URL we made the request to shows that we were redirected.</p><p>I don’t imagine this pattern to be very useful; but if this helps you, or doesn’t work for some reason, please ping me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbc2500052f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Summer Spent Studying, Part II]]></title>
            <link>https://medium.com/@frontsideair/a-summer-spent-studying-part-ii-c038f87e60de?source=rss-155954bb4ea9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c038f87e60de</guid>
            <dc:creator><![CDATA[Fatih Altınok]]></dc:creator>
            <pubDate>Wed, 01 Oct 2014 17:38:34 GMT</pubDate>
            <atom:updated>2014-10-01T17:38:34.964Z</atom:updated>
            <content:encoded><![CDATA[<p>…and the motivation for my first project, Dropbox Window</p><p>When starting a fun project, it’s essential that you’re doing it to scratch an itch you have. It goes without saying, but let’s just say it: you’ll need every reason to motivate you see it through, and as an upside you’ll know the exact use cases and you’ll be able design for them. Isn&#39;t it just great?</p><p>So I had this itch of mine for a long time. Sometimes when I’m using a computer that I don’t own to edit some document or whatever, I need the files afterwards. Like when I want to keep the homework I did in the library, or some AutoCAD drawing from computer lab, or when I’m printing out stuff at the internet cafe and made a last second change I don’t want to lose. You’re lucky if you have a USB stick with you, but even then you might not feel like putting the drive where you keep important files to a virus laden, filthy computer.</p><p>USB sticks are so 2006 and to be honest, I don’t keep one around anymore. Everything’s on the cloud, right? And if I need to print out a file, I just generate a public Dropbox link on my smartphone and I’m good to go. But it’s frustrating I can’t do it the other way. (I think you see now where this all is headed.) Well, maybe you can. You can just navigate to the Dropbox website and after logging in you can upload the files you need, but I don’t think I would.</p><p>I see no shame in admitting that I’m a fairly paranoid person. I never log into any service on any device I don’t own. I use KeePass to store my randomly-generated non-reused 24+ character alphanumeric passwords for each service I register to and use two-factor authentication where it’s available. Even if I wanted to login on an untrusted computer, it wouldn&#39;t be an easy task. But that’s a fair trade-off for security.</p><p>Does it seem unreasonable to want to use Dropbox on an untrusted computer and still have an easy login procedure? I think not. I believe in ease of use and I’ll pursue it no matter what. And it gets easier when you see it’s actually doable. That’s why I fell in love with <a href="http://web.airdroid.com/">AirDroid login</a> when I first laid my eyes on it. (Go see it if you haven’t. I’ll wait, promise.)</p><p>I’ll just go on and explain how it solved the login problem in case you didn&#39;t check it. You install the AirDroid app on your phone and point your browser to <em>web.airdroid.com</em> and then scan the barcode on the page using the app. That’s just it, you’re in! It’s simple and elegant. Even if the computer you’re using is compromised, no login information is transmitted. No username, no password, nothing. And that’s what I wanted to have.</p><p>I had a vision of the finished product. You would point the browser to the Dropbox Window website and it would simply state its purpose and prompt a QR code (and a URI if the trusted device doesn&#39;t have a camera). Scanning the code and then authenticating the app will in turn authenticate the client so you can start uploading immediately. It’s easy <em>and</em> secure. The client doesn&#39;t get your credentials, just an access token —which you can deauthorize using your phone. Even if you forget to deauthorize, an adversary is limited to the contents of the app folder; other files in your Dropbox are safe. And you can revoke the app itself later on, which will render any leaked access token useless.</p><p>The great thing about this is, the possibilities are endless. I just drew a picture of use cases I cared about, where it’s a good alternative to mailing files to yourself. But you can use it when you need to send a file to someone, but you don’t trust them enough to give your email address. You can implement this same login scheme for other services too. I read a while back that Google acquired a company experimenting with sound based authentication, and I hope it gets widespread. Logging in is a mess and it needs to be fixed.</p><p>I started with these ideas and drew some mockups, designed client-server relationship and the API. I implemented the server side using Flask and Dropbox Python API, and client side with many web development tools including jQuery, Web Starter Kit, PureCSS, etc. It was a great experience and kind of overwhelming designing such a software that touches so many different tools, services and technologies; but fun nevertheless. Right now it’s at 90% but I know that the remaining 10% will take as much time. I’ll release the source code with a permissive license, as soon as I think it’s polished enough.</p><p>On the studying front, I enrolled in two more courses on Coursera; <a href="https://www.coursera.org/course/automata">Automata</a> and <a href="https://www.coursera.org/course/crypto">Cryptography I</a>. I think with these two, I’ll have been covered pretty much over 2/3 of a standard CS curriculum. While my approach a bit different, this summer study turned out a lot like Scott H Young’s <a href="http://www.scotthyoung.com/blog/mit-challenge/">MIT Challenge</a>. There are still some topics I didn&#39;t cover yet, but I’m getting there and I don’t think I will ever say enough or stop. I love learning new and interesting stuff and while I find fun in that, it’ll keep me going.</p><p>I’ll keep posting as long as I find interesting stuff, so keep an eye out. And if you’re interested in hiring me, please contact me on <a href="https://twitter.com/frontsideair">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c038f87e60de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why did I spend most of my summer studying right after I graduated?]]></title>
            <link>https://medium.com/@frontsideair/why-did-i-spend-most-of-my-summer-studying-right-after-i-graduated-add4b6f97c67?source=rss-155954bb4ea9------2</link>
            <guid isPermaLink="false">https://medium.com/p/add4b6f97c67</guid>
            <dc:creator><![CDATA[Fatih Altınok]]></dc:creator>
            <pubDate>Sat, 23 Aug 2014 07:52:45 GMT</pubDate>
            <atom:updated>2014-09-15T02:57:29.640Z</atom:updated>
            <content:encoded><![CDATA[<p>I graduated from mechanical engineering about three months ago, moved to another city and started looking for a job. Well, I didn&#39;t have much luck finding a job, so I pivoted. This is the curious story of a summer spent studying.</p><p>Now I can admit, I wasn&#39;t cut out for mechanical engineering. It took me 9 years to graduate! (Most of which I spent dwelling in depression.) It was a horrid experience, but once I found motivation and saw there was no other way out, I grudgingly finished it. I might have enjoyed some of it too. (When your efforts come around, you’re bound to enjoy it, was my lesson.) I didn&#39;t graduate with flying colors, but it was better than nothing. But I was certain, I wouldn&#39;t be a mechanical engineer, not in a million years.</p><p>Thinking back, I realize it was a very bad decision. When we’re college age, I think most of us are too young to be making these life-changing decisions. I was kind of interested in industrial design then, but my impression of industrial design was far off. Anyways, it was a new and rare thing, and I didn&#39;t score high enough; so I was stuck with mechanical engineering. A friend of my father’s said they were basically the same thing —yeah, right— and I didn&#39;t know better. Thanks for my lost 9 years, dude.</p><p>Anyways, I don’t think I should put the blame on him, or anyone for that matter. I was starting to get existential back then, and maybe it wouldn&#39;t turn out much different if I chose some other major. And really, there’s no use complaining about the past, damage is done, and I survived. So I though, I don’t wanna be a mechanical engineer, but a software developer, but how? I was a Linux user for pretty much 9 years and I did some Javascript back when I was in high school, so I could apply for a developer job, right?</p><p>Nope, soon I learned. I thought I could do the job, and I’d learn anything given the opportunity, but business don&#39;t work that way. I didn&#39;t have the educational requirements —having an unrelated degree wouldn&#39;t help much— didn&#39;t have the experience and no portfolio to show off. Turns out reading techie stuff on Hacker News wasn&#39;t the same as actually knowing those things. It was after a month of not getting hired that I realized I had to do <em>something</em>. And that’s how I started.</p><p>I discovered Nand2Tetris online course —<a href="https://medium.com/p/what-i-learned-from-nand2tetris-2fde322ba3cf">which I wrote about</a>— couple months ago on —guess what— Hacker News. It seemed super fun and I’d bookmarked it. It covered a vast number of topics which looked cool, educational and potentially helpful to my dream career, so I decided to pursue it. (SPOILER: I completed it with flying colors!) But was it enough?</p><p>Not really. While it was really expansive, it didn&#39;t and couldn&#39;t cover the whole CS curriculum. So I went on with data structures and algorithms. (It looked fun and I heard it was essential for job interviews.) After some investigation I decided on enrolling in Sedgewicks’s <a href="https://www.coursera.org/course/algs4partI">Algorithms (Part I)</a> course on Coursera. I had good experience with Coursera —when last year I took the <a href="https://www.coursera.org/course/proglang">Programming Languages</a> course by Dan Grossman last, great guy!— and this Sedgewick dude looked like he knew his stuff. (He developed a simpler red-black tree, the left-leaning red black tree —impressive!)</p><p>With this also now completed, I think I will focus on my portfolio next, and do some real world projects. After that I’ll finally feel ready to apply for a developer job, this time for real. It’s been a really fun and challenging summer, and while a learned a ton of programming, I also learned about how I learn best: by doing.</p><p>I’ll detail this and my upcoming project when it’s done, so stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=add4b6f97c67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I learned from Nand2Tetris]]></title>
            <link>https://medium.com/@frontsideair/what-i-learned-from-nand2tetris-2fde322ba3cf?source=rss-155954bb4ea9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fde322ba3cf</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Fatih Altınok]]></dc:creator>
            <pubDate>Fri, 08 Aug 2014 20:01:16 GMT</pubDate>
            <atom:updated>2016-12-09T23:51:52.163Z</atom:updated>
            <content:encoded><![CDATA[<h3>What I learned from Nand2Tetris</h3><p>I completed the The Elements of Computing Systems course, a.k.a. Nand2Tetris just now, and I wanted to share what I learned from it while my memories are still warm.</p><p>I started it roughly a month ago, out of curiosity. It looked like an expansive course touching so many topics I wanted to research, but found tiresome to do. The description said it didn’t go into the gory details, which was a great relief for me. It was also mostly self-contained, and that was appealing too, because I’m mostly a novice programmer.</p><p>I gotta admit, I was into programming since I was a middle-schooler, but I never got the chance to really dive into it. It was nothing but laziness, since I always found programming intriguing. Although I haven’t been programming at all, I’m an avid Hacker News reader.</p><p>Let’s talk about the course, not me. It starts with the logic gates and walks you through building a complete computing system, hardware and software. While you need to build all the components, it’s recommended to follow the design given in the course materials. Designing the system by yourself would be out of the scope of the course, and in many cases, reinventing the wheel.</p><p>First you’re introduced to the logic gates, and you’re supposed to build all basic gates out of NAND gates, and other gates you have built on the way. It’s basically the essence of the course; you got to build bigger things using what you built in the previous chapters. You build arithmetic units and ALU on top of the logic gates you built. Then you’re introduced to sequential logic and you build registers, RAM and program counter. With the help of those, you’ll build a CPU, memory and eventually the computer. The last thing you do in the first half of the course is writing an assembler that converts assembly code — its specification is provided — to the hardware description language you’ve been using to combine the logic gates.</p><p>My first choice of programming language for building the assembler was Ruby, but after I wrote the skeleton of the API, I scrapped it and switched to Python. I feel like it would be more natural to write in Ruby than Python, but it was a pragmatic choice. While Ruby is pretty mature now, Python is used more widely and it’s easier to find a job with Python experience here in where I live.</p><p>The second half of the course is about making a modern computing platform. This requires you to build two parts of a compiler; the first half translates intermediate virtual machine code to assembly language of the hardware platform (called ‘Hack’), while the second part compiles the high level Java-like code (called ‘Jack’) to the VM bytecode. Since writing a compiler is pretty hard, it’s split into two chapters. When building the VM translator, first you learn stack arithmetic and use it to perform arithmetic operations. You also implement access to different memory blocks, and this concludes the first part of the VM.</p><p>Second part of the VM implementation handles the function calling and branching part of the virtual machine. It seems easy at first, but function calling requires you to push arguments, local variables and so on; and you have to deallocate these when returning from the function. You also need to return a variable, but if that function has void type, the return value (which is ‘0&#39; for null functions) is discarded (popped to an unused memory segment). It takes a lot of time and patience, but it’s pretty enlightening.</p><p>With the virtual machine completed, you learn the specification of the high-level language, Jack. You come back to it for the next two chapters, where you build the second part of the compiler. The first chapter dedicated to the compiler is about syntax analysis and building a tokenizer. I knew the term tokenizer and abstract syntax tree before, back when I was learning Lisp, but I didn’t appreciate Lisp before building one myself. I could use Python’s Pygments library for this part, but I wanted to get my hands dirty instead. It wasn’t particularly pretty. I had to generate an XML tree and it was one of the most horrible things I had to deal with in my whole life. Unfortunately, the reference files I had to compare with were XML, so I didn’t have much choice.</p><p>After countless curses to XML I completed it and went on with the second part; code generation. I had to add a symbol table to keep track of the variables and replace the tokenizer output module to output VM bytecode instead of XML. It seemed fairly easy, but turned out really hard and time consuming. There were six tests, and my code broke in every single one of them. I’d pass one test and the next one would throw errors I wouldn’t even imagine. I guess it was because I forgot the VM code and design while I was building the tokenizer part and dealing with ugly, ugly XML.</p><p>Sometimes I would get really hopeless and cheat a little by compiling the test code with the provided compiler and decrypting the VM code in my head. (Well, I wouldn’t really call it cheating, the compiler was there and compiled code was kind of a reference.) In the end I fixed all the bugs which didn’t let it pass the test and it still wouldn’t compile the test code for the next chapter correctly. (The provided compiler would also show useful error messages for errors in my Jack code, which I didn’t implement in my half-baked compiler. I didn’t really care because I had to move on and passing the tests were good enough for me.)</p><p>That was an important part of the course. I mean, I would read a book about compilers, but all the details and optimization and whatnot would just confuse me and I’d get discouraged and drop it. This course is — in its own words — simple enough, but not simpler. You’re developing everything on your own. You’re just provided with the design and implementation tips but nothing more. There’s the VM Emulator, which runs your VM code instead of you translating it into hardware code and running it on the Hardware Simulator, but it’s there just for the sake of efficiency. Once you build the VM, you can run it on the Hardware Simulator if you have a really fast computer. (It doesn’t get any lower-level than the Hardware Simulator though; actually building the hardware is out of the scope of the course.)</p><p>It was a really great experience to take this course. I did it at my own pace and it took a little more than a month. (Including vacations and breaks I took out of desperation.) It touched so many different topics, teaching me of their essence; if I wanted to pursue any single one, I would know what to expect. The chapters were well split and completing them were just hard enough to keep my interest while giving me the feeling of accomplishment for doing it. It’s truly a job well done.</p><p>The last chapter was about building the operating system and standard library functions in Jack language, previously provided for testing purposes. It briefly touched the topics of algorithms, complexity and data structures. As my next move, I’ll dive into these, which seems pretty important. Oh, and lastly when I was learning about the specs of the Jack language I was supposed to build a game in it, I chose to build a single player Pong clone; which looks more Breakout than Pong, minus the bricks. One of the things I really wanted to get into was game development, and I made my first mini-game in this course, with a language I have implemented!</p><p>All in all, I’m really happy I took this course. This is my favorite course so far, maybe head to head with Programming Languages course by Dan Grossman I took a year ago on Coursera. It taught me many topics I was curious about, while keeping fun, and in a month. What else could I expect?</p><p>If you’re into programming but you’re too young for college, or studying another major, or graduated and looking for a fun project; I completely recommend this course. Even if you’re a starter. (According to the course introduction, it’s CS101 in at least one college.)</p><p>One more thing. It’s never too late. I graduated from mechanical engineering and I’m planning on pursuing a career of programming. I’ll be taking more courses, learning and developing. So if you’re interested in hiring me, contact me on my Twitter.</p><p><em>Update 10/2016: I have a full time job at a great company and working on my M.S. on Computer Science. Guess I was on the right track.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fde322ba3cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>