<?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 Ali Oğuzhan Yıldız on Medium]]></title>
        <description><![CDATA[Stories by Ali Oğuzhan Yıldız on Medium]]></description>
        <link>https://medium.com/@alioguzhan?source=rss-6b8b105c48c1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*zKAoZAiP09VkZnv6TZimog.jpeg</url>
            <title>Stories by Ali Oğuzhan Yıldız on Medium</title>
            <link>https://medium.com/@alioguzhan?source=rss-6b8b105c48c1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 12:37:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alioguzhan/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[Packing Custom Fonts for NixOS]]></title>
            <link>https://alioguzhan.medium.com/packing-custom-fonts-for-nixos-8afac954c5ca?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8afac954c5ca</guid>
            <category><![CDATA[nixos]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[nix]]></category>
            <category><![CDATA[fonts]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Sun, 04 Aug 2024 18:04:00 GMT</pubDate>
            <atom:updated>2024-08-12T11:08:34.064Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Originally published at </em><a href="https://yildiz.dev/posts/packing-custom-fonts-for-nixos/"><em>yildiz.dev</em></a><em> on April 5, 2024.</em></p><p>I have been using <a href="https://nixos.org/">NixOS</a> for a long time. And I am very happy with it. It is very stable and easy to configure.</p><p>With NixOS, installing and configuring famous and open-source fonts is already very straightforward. Here is my font configuration in configuration.nix:</p><pre>fonts = {<br>    fontDir.enable = true;<br>    enableGhostscriptFonts = true;<br>    packages = with pkgs; [<br>      cantarell-fonts<br>      hack-font<br>      inter<br>      jetbrains-mono<br>      liberation_ttf<br>      monaspace<br>      noto-fonts<br>      ubuntu_font_family<br>      (nerdfonts.override { fonts = [ &quot;FiraCode&quot; &quot;DroidSansMono&quot; &quot;JetBrainsMono&quot; ]; })<br>    ];<br>  };</pre><p>Things get a little bit complicated when you want to use a custom or any commercial font that is not available in Nix packages. I am using <a href="https://berkeleygraphics.com/typefaces/berkeley-mono">Berkeley Mono</a>. It is a great font for both the editor and the terminal. And here is how I packed it for NixOS:</p><h3>Adding the Font to the NixOS Configuration</h3><p>We need to add the font to our NixOS configuration so it will be installed and available after the build.</p><p>There are a few ways to do this. You can zip your font and add it to your config repository. Or you can serve the font files from<br> a web server with some credentials. Since my config repo is not public, I am using the first option. Here is how I did it:</p><p>First, create a derivation for our font:</p><pre># make a  derivation for berkeley-mono font installation<br>{ pkgs }:<br><br>pkgs.stdenv.mkDerivation {<br>  pname = &quot;berkeley-mono-typeface&quot;;<br>  version = &quot;1.009&quot;;<br><br>  src = ../../assets/berkeley-mono.zip;<br><br>  unpackPhase = &#39;&#39;<br>    runHook preUnpack<br>    ${pkgs.unzip}/bin/unzip $src<br><br>    runHook postUnpack<br>  &#39;&#39;;<br><br>  installPhase = &#39;&#39;<br>    runHook preInstall<br><br>    install -Dm644 berkeley-mono-patched/*.ttf -t $out/share/fonts/truetype<br><br>    runHook postInstall<br>  &#39;&#39;;<br>}</pre><p>Note that src part. It points to the zip file, which I put under the assets directory in my config repository.</p><p>I save this file as berkeley-mono-typeface.nix under the packages directory alongside my other custom packages.</p><p>Now we need to access this package from our configuration.nix file:</p><pre>let<br>  berkeley-mono-typeface = pkgs.callPackage ./packages/berkeley-mono-typeface { inherit pkgs };<br>in<br># other configurations<br># ....<br><br>fonts = {<br>    fontDir.enable = true;<br>    enableGhostscriptFonts = true;<br>    packages = with pkgs; [<br>      cantarell-fonts<br>      hack-font<br>      inter<br>      jetbrains-mono<br>      liberation_ttf<br>      monaspace<br>      noto-fonts<br>      ubuntu_font_family<br>      (nerdfonts.override { fonts = [ &quot;FiraCode&quot; &quot;DroidSansMono&quot; &quot;JetBrainsMono&quot; ]; })<br>      berkeley-mono-typeface # It is here!<br>    ];<br>};</pre><p>And that’s it. Now rebuild your NixOS and you should be able to use your font.</p><h3>Bonus: Patching the Font</h3><p>Specifically, Berkeley Mono provides very few glyphs. To have all those fancy icons and symbols used in your editors and terminal, we<br> need to patch the font. Thankfully, it is very easy to patch the font with <a href="https://github.com/ryanoasis/nerd-fonts?tab=readme-ov-file#font-patcher">Nerd Font Patcher</a>:</p><pre>docker run --rm -v ./berkeley-mono:/in:Z -v ./berkeley-mono-patched:/out:Z nerdfonts/patcher --mono --adjust-line-height --progressbars --complete</pre><p>Assuming your berkeley-mono directory, which contains the TTF and OTF folders, this command will patch the fonts<br> and put them into the berkeley-mono-patched directory.</p><p>If you also want to patch your font before using it on your system, you can tweak the above command and use it.</p><blockquote><em>With the above patch command, our font will be available with the name </em><em>BerkeleyMono Nerd Font Mono. So you need to use this name when you want to use it in your editor or terminal. If you remove the </em><em>--mono flag, then it will be </em><em>BerkeleyMono Nerd Font. You get the idea.</em></blockquote><p>Enjoy your new font!</p><p><em>Originally published at </em><a href="https://yildiz.dev/posts/packing-custom-fonts-for-nixos/"><em>yildiz.dev</em></a><em> on April 5, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8afac954c5ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate Migration: I finally sold my Macbook]]></title>
            <link>https://alioguzhan.medium.com/the-ultimate-migration-i-finally-sold-my-macbook-fa4f7b7e0fb?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa4f7b7e0fb</guid>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[macbook]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Sat, 28 Nov 2020 15:09:50 GMT</pubDate>
            <atom:updated>2020-11-29T19:39:30.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*JkUZW5dqYJJG_hL2.png" /><figcaption>Image source: <a href="https://www.zendesk.com/blog/customer-service-data-migration/">Zendesk Blog</a></figcaption></figure><p><em>Originally published at </em><a href="https://yildiz.dev/2020/11/28/the-ultimate-migration/"><em>https://yildiz.dev</em></a><em> on November 28, 2020.</em></p><h3>Preliminary</h3><p>I am a software developer and I have been using Apple computers since 2012. 2012 is also when my professional career had started.</p><p>It was always Macbook Pro but with different generations (2012, 2014, and 2015). I also have an iPhone, an Apple Watch, and an AirPods. I am saying this in advance so you can have an idea about how deeply coupled I’m into the Apple ecosystem. Once you go deep down that much, It is becoming much harder to break your chains. That perfect harmony between iDevices. Answering your calls, replying to messages, copying and pasting across devices, etc. You know what I mean.</p><p>But from a development perspective, at some point, <strong>I realized that the only tool that converts my Macbook into a development machine is </strong><a href="https://brew.sh/"><strong>homebrew</strong></a>:</p><blockquote><em>A third-party package manager to help people act like and install packages like they are using a Linux operating system.</em></blockquote><p>Well, this explains a lot by itself. So, during the past few years, I started to think about switching to Linux. In fact, I did switch.</p><p>But not in a proper way…</p><h3>The Proper Way</h3><p>TLDR; The proper way for me was switching to Linux without keeping the Macbook.</p><p>Why is that? Because every time I tried to switch, I knew deep down inside that I always can go back to macOS. Just format the drive and re-install the macOS. Because of this so-called relief feeling, I never was able to concentrate on using Linux as a daily driver.</p><p>Trying to peer my Bluetooth keyboard to Ubuntu: Did it fail the first time?</p><blockquote><em>Forget it. The whole Linux thing is crap. It even is not capable of connecting my keyboard. And consider using this OS for my job. No way!</em></blockquote><p>This and a bunch of other relatively small issues. I never tried to fix the problem. I always gave up at the first obstacle I faced. I was always thinking like there should be no problem not at all. And as a developer, now I feel ashamed because of this approach. I earn my life by solving problems…</p><h3>Say Hi to my new Thinkpad</h3><p>I always knew that if one day I leave my Macbook and migrate to Linux, Thinkpad will be the laptop that I will be using.</p><p>And 2 weeks ago, I found this <a href="https://www.lenovo.com/gb/en/laptops/thinkpad/t-series/ThinkPad-T14s-G1/p/20T0001EUK">Thinkpad T14s Gen 1</a>.</p><p>After days of hardware and compatibility reading, I decided to buy it. I sold my Macbook Pro (2015) to the same store that sells this Thinkpad and I paid some extra cash to close the gap. I was tired of so many cables coming and out around my computer so I also bought that <a href="https://www.amazon.com/CalDigit-USB-C-Pro-Dock-Thunderbolt/dp/B07VL675DT">CalDigit Pro Dock</a> to organize my cables.</p><p><em>Honestly, I did not expect this much elegance from a non-Apple laptop. I loved it at first sight when I unboxed it.</em></p><p>It is thinner and lighter. And that keyboard.</p><p>Spoiler alert: I am barely using my mechanical keyboard(s) since I bought this laptop. And for the record, I do love my mechanical keyboards.<br>The blue switch is my favorite. I did not touch a laptop keyboard for years. At the office, at home, on vacation: I always carry a mechanical keyboard wherever I go.</p><h3>Hello Linux</h3><p>TLDR: After a few tries I ended up using Ubuntu 20.04. Here is the neofetch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/0*K7qmsFGpiFjN1C4k.png" /><figcaption>my computer specs and config</figcaption></figure><h3>Fingerprint</h3><p>It is just working great. You can’t imagine how I was surprised when the fingerprint sensor just worked out-of-the-box with Ubuntu.</p><h3>Desktop Environment</h3><p>I am happy with GNOME. I did not tweak too many things to make my Thinkpad look like macOS. That was what I was trying to achieve on my previous attempts.</p><blockquote><em>I need to configure dozens of things so my Linux environment looks like a macOS.</em></blockquote><p>No. What is the point of migration to Linux then? I love my operating system as it is now. Here a few screenshots from my Desktop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Eukn2AmhErX_ktrB.png" /></figure><p>Launchpad also looks cool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AHoZh6oadnNcdM4v.png" /></figure><h3>Karabiner Elements</h3><p>Probably the best program I ever installed on my Macbook. I am a big fan of the <a href="https://stevelosh.com/blog/2012/10/a-modern-space-cadet/">Modern Space Cadet</a> article from Steve Losh. I map my shift keys to parentheses when pressed alone. They act like regular shifts when pressed with a key. This is how I use my computers since 2013. As a replacement, I found <a href="https://gitlab.com/interception/linux/plugins/dual-function-keys">Dual Function Keys</a>. I compiled it and generated a config file to achieve <a href="https://stevelosh.com/blog/2012/10/a-modern-space-cadet/#s17-shift-parentheses">Better Shifting</a>. It is working great.</p><h3>AirPods (Gen 2)</h3><p>It is working without any problem as headphones. I also was able to pair it as the headset after tweaking some Bluetooth configs but I think it falls to half-duplex mode from full-duplex when activated as a headset. So, sound quality gets worse. No need. Thinkpad&#39;s mic is pretty good for online meetings. So I decided to leave it as just headphones.</p><p>It automatically connects when I pull it out from the box and tapping gestures also work. I can stop and play the videos/songs by tapping my ear. That is more than enough for me.</p><h3>iCloud Calendar</h3><p>My wife is using a Macbook Pro. She also has an iPhone and I do have another one. So we are using the iCloud calendar with sharing options a lot. And being able to connect my iCloud calendar made me happy so much. With 15 mins of work, now I can send and receive events and notifications right from the default GNOME Calendar. Great.</p><h3>Time Machine</h3><p>You can write a simple rsync script and schedule it with a cron job. There you go. Simplified Time Machine. Or, you can go ahead and install <a href="https://github.com/teejee2008/timeshift">Timeshift</a>.</p><p>It is just like Time Machine. Select what to include and what to exclude. Select your backup folder or external hard drive. Schedule your backups. And you are good to go. You also can restore a whole system from Timeshift snapshots. I tested it. It is working.</p><h3>Trackpad Gestures</h3><p>This was easy. I just installed <a href="https://github.com/bulletmark/libinput-gestures">libinput-gestures</a> and configured it for myself. Now I can use three-finger gestures on my touchpad.</p><p>I have been using that app for years. It was like some default built-in app for me. There are some great replacements for this in the Linux world. Probably the most configurable one is <a href="https://github.com/polybar/polybar">Polybar</a>. But I just installed <a href="https://github.com/corecoding/Vitals">Vitals</a> gnome extension. It is quite nice and simple. No distraction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*4WLfx9DGrMlHLrJK.png" /></figure><h3>Space to File Preview</h3><p>in macOS, we can have a quick look at any file by pressing Space. This is much quicker than opening the file, checking its content then closing again. I found <a href="https://gitlab.gnome.org/GNOME/sushi">Gnome Sushi</a>. No further word is needed. It has the same functionality.</p><h3>CalDigit Pro Dock</h3><p>It is officially supported only for macOS and Windows. But speaking for Ubuntu, all ports on it worked without any config or driver installation.</p><h3>Problems</h3><p>Of course, not everything is flawless. Some parts are missing. I am pretty happy with this migration so far but here a few cons:</p><ol><li>1920x1080 is not even comparable to the Macbook&#39;s Retina Display.</li><li>Since scaling is another problem in the Linux world, I can’t use my 27 inch 4K Display properly.</li><li>I probably will end up selling my 4k monitor and buying a Full HD IPS monitor.</li><li>Cmd Key! After 8 years of macOS, It is really hard for me to not having a CMD key. There is no direct replacement for the CMD key in Linux.</li></ol><h3>Closure</h3><p>It feels <strong>natural</strong>. Yes, I really thought about that word while writing this. Yes, the display is not so great. Yes, all those fancy apps are being developed for mostly macOS and sometimes Windows. It still feels strange when I have to clone, compile, and install a program to use on my Desktop. But the ultimate feeling for me is natural:</p><blockquote><em>It is like this whole Linux ecosystem was meant to be a development environment.</em></blockquote><p>I will be sharing my future experiences as I discover new things or problems in the Linux world. Let’s keep in touch.</p><p>Thanks for reading.</p><p><em>Originally published at </em><a href="https://yildiz.dev/2020/11/28/the-ultimate-migration/"><em>https://yildiz.dev</em></a><em> on November 28, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa4f7b7e0fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Glossary for Javascript World]]></title>
            <link>https://alioguzhan.medium.com/a-glossary-for-javascript-world-e8b646d31e5d?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8b646d31e5d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Thu, 20 Sep 2018 11:45:02 GMT</pubDate>
            <atom:updated>2021-06-30T18:17:48.774Z</atom:updated>
            <content:encoded><![CDATA[<p><em>You can also read this here on my personal web site:</em></p><p><a href="https://yildiz.dev/2018/09/20/a-glossary-for-javascript-world/"><em>https://yildiz.dev/2018/09/20/a-glossary-for-javascript-world/</em></a></p><p>Javascript is growing (also evolving) <a href="https://www.npmjs.com/">fast</a>. I mean<a href="https://www.npmjs.com/npm/state-of-javascript-frameworks-2017-part-1"> very fast</a>. There are tons of libraries, frameworks, compilers, bundlers or even <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Language_Resources">several standards</a>.</p><p>Even if you are developing in Javascript since the beginning, it still might be difficult to catch up with this evolution’s speed.</p><p>Here i tried to gather most of those technologies and technical terms together with their definitions, missions and relations to each other.</p><p><strong>If you are new to either programming or web development, this post is supposed to give you some idea about Javascript and its ecosystem.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tTrdwwj2VWIWvrOC" /><figcaption>“A bright neon on a brick wall in a store” by <a href="https://unsplash.com/@austinchan?utm_source=medium&amp;utm_medium=referral">Austin Chan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When i decided to write this post i wanted to cover everything from scratch including what ECMAScript is, its relation with Javascript and how they overlapped each other in years. During research, i found this great article:</p><p><a href="https://medium.freecodecamp.org/whats-the-difference-between-javascript-and-ecmascript-cba48c73a2b5">What’s the difference between JavaScript and ECMAScript?</a></p><p>First you may want to have a look at this article. It will provide you a very solid knowledge about Javascript’s history and legal status.</p><h4>— ECMAScript ( or ES )</h4><p>EcmaScript is not a programming language. It is a standard, a declaration or a specification that covers how an <em>EcmaScript</em> implementation should be designed. You can find that standard <a href="https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">here</a>. For a more detailed explanation on EcmaScript see the article i mentioned above.</p><h4>— JavaScript ( JS )</h4><p>Ok. Now we have required instructions and rules (<em>Ecma Standard</em>) to create a scripting language. The name of the language that we created based on the rules in that standard is JavaScript.</p><p>Things are getting weird at this point. Because it is more appropriate if we name this as <em>an implementation</em> instead of <em>a language</em>. How?</p><p>Javascript lives in the browsers (well, at least mostly). Every major browser vendor have their own EcmaScript implementation. They create their own JavaScript<em> </em>based on the rules and specifications in Ecma Standard:</p><ul><li>Google’s <a href="https://github.com/v8/v8">V8 Engine</a> used in <em>Google Chrome</em></li><li>Mozilla’s <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey">SpiderMonkey Engine</a> used mainly in <em>Firefox</em></li><li>Microsoft’s <a href="https://github.com/Microsoft/ChakraCore">Chakra Engine</a> used in <em>Microsoft Edge</em></li></ul><p>All of these are JavaScript implementations created by different people in different companies. They simply create a programming language by reading Ecma Standard line by line, literally. Now we have an understanding about what JS is and how it is implemented across multiple browsers.</p><h4>— Babel</h4><p>The Standard forces the vendors mostly on <em>the way of how features should be implemented</em>. So, it does <strong>NOT</strong> say:</p><blockquote>Hey! You have to implement every single feature that we specified here.</blockquote><p>Well, this is totally fair and understandable. After all, it is just a specification. Not a constitution. At this point, We are facing a new problem: Compatibility.</p><p>Let’s create another example scenario:</p><blockquote>ECMA Organisation released a new version of EcmaScript. And in that version there is a new feature, let’s call it <em>Feature X</em> . This is a completely new feature and brings some big improvements to the language. You are super excited about this. You want to use it immediately in your next project.</blockquote><p>But guess what? There is no guarantee that all those browsers will implement this <em>Feature X</em> in their next release. No. Not at all.</p><p>Babel comes into play just at this very point. Babel is a Javascript transpiler (or compiler?). To be more specific, from <a href="https://babeljs.io/">the official website</a>:</p><blockquote>Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments</blockquote><p>This is pretty obvious actually. What Babel does is converting your cutting-edge Javascript code into an older Javascript so that our application is supported from all major browsers. You can see some great animated code examples on Babel web site:</p><p><a href="https://babeljs.io/">Babel · The compiler for next generation JavaScript</a></p><p>A real world example for support differences between browsers would be the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API">Service Worker API</a> and the Safari browser. Some <a href="https://developers.google.com/web/fundamentals/primers/service-workers/">preliminary</a> for service workers:</p><blockquote>Rich offline experiences, periodic background syncs, push notifications — functionality that would normally require a native application — are coming to the web. Service workers provide the technical foundation that all these features rely on.</blockquote><p>Service Workers API first announced in 2015. It’s been around for almost 4 years. Yet, Apple still didn’t implement it to the Safari (They recently announced it in Safari Technology Preview). Yes, you created an application enriched with service workers. Well, your application wouldn’t work as expected in Safari browsers.</p><p><em>In the context of this example, Babel has </em><strong><em>NO</em></strong><em> solution for service workers compatibility. This feature is mostly (not completely) related to the browser itself instead of the language syntax.</em></p><h4>— Node JS</h4><p>Back in 2009, <a href="https://en.wikipedia.org/wiki/Ryan_Dahl">Ryan Dahl</a>, a Google Engineer, came up with an idea:</p><blockquote>What if I pull V8 Engine out from Chrome Browser and run it as a standalone environment?</blockquote><p>Well, THIS, was a huge leap for Javascript World. Actually i am pretty sure that THIS is the main reason for the popularity of JS today. Being able to use a programming language on the server-side, which is already popular on client-side. That was simply a game-changer. Since it is non-blocking, event-driven, it can handle much more traffic with less hardware. Single technology stack to build web applications. Learn JS and you are fine. Use literally the same library to parse strings for both back-end and front-end. Sounds good, right? Same package manager, same dependencies, same data types and structure…</p><p><a href="https://nodejs.org/en/">Node.js - Run JavaScript Everywhere</a></p><h4>— Webpack</h4><p>Webpack is an open source Javascript module bundler.</p><p><a href="https://github.com/webpack/webpack">GitHub - webpack/webpack: A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through &quot;loaders&quot;, modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.</a></p><p>Ok, what is a module bundler and why we need it? Let’s continue with an example scenario:</p><p>We are building a web application consists of several components and pages. And we are using different helper libraries and third-party components across our application. We,</p><ul><li>want to use SASS for our styles,</li><li>want to minify / uglify our code,</li><li>don’t want to deal dozens of imports and references</li><li>want to integrate Babel to use latest EcmaScript features</li><li>want all of them with minimum effort and configuration.</li></ul><p>This is exactly what webpack does. You can achieve all of above or even more with just one single configuration file. It can transform your code and dependencies and generate single bundled file that contains everything needed to your application works:</p><ul><li>bundle.min.js</li><li>bundle.min.css</li></ul><p>That’s it. Just import those two files in your base html file and we are good to go.</p><p>Of course this is a very basic example. You can do much more with webpack. But i hope this gives you some base knowledge about webpack and other module bundlers outside. And yes, there are plenty of them. Here some:</p><ul><li><a href="http://browserify.org/">Browserify</a></li><li><a href="https://rollupjs.org/">Rollup</a></li><li><a href="https://parceljs.org/">Parcel</a></li><li><a href="https://github.com/developit/microbundle">Microbundle</a></li></ul><h4>— Electron</h4><p>First official definition:</p><blockquote><a href="https://electronjs.org/">Electron</a> is an open source library developed by GitHub for building cross-platform desktop applications with HTML, CSS, and JavaScript.</blockquote><p>Electron is created by <a href="https://github.com/zcbenz">Cheng Zhao</a> at Github to support and improve the development of <a href="https://atom.io/">Atom Editor</a>. It is based on Node JS and Chromium. You can read more about its history and technical background <a href="http://cheng.guru/blog/2016/11/13/evolution-of-electron.html">here</a>:</p><p>Thanks to Node JS, we had the chance to create server-side applications with JS. With Electron, we take this a step further: Writing desktop applications in JS.</p><p>And yes, it is cross-platform. Single code base. Write your application once, run it everywhere. Package your application for desired operating system. It supports Mac OS, Linux and even Windows. Although everyone moving to web, desktop applications are still preferred by many. And from developer perspective, it is so much pain to create an application for all major operating systems by writing the code in different environments. Too much development time, effort and budget. Even if you are Microsoft:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*q96Ww1K0fd2pZ5FEFdQwZg.png" /><figcaption>Some apps built on Electron. <a href="https://electronjs.org/">https://electronjs.org/</a></figcaption></figure><p>This is just the warm up. Let’s move on.</p><h4>— React</h4><p>You probably hear or see this word very often. What is React?</p><blockquote>React is a JavaScript library for building user interfaces.</blockquote><p>First of all, React is NOT a framework. It is a library created by Facebook in 2013. It is V in MVC (<a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller</a>) pattern. Though you can turn it into a framework by using some third-party helper libraries and components like <a href="https://github.com/ReactTraining/react-router">react-router</a> and <a href="https://redux.js.org/">redux</a>.</p><p>You can create complex applications without losing the control over your code. One of the greatest feature of React is component system. You can create reusable smart or dumb elements to build your application more efficiently.</p><p>I strongly recommend you to take a look React’s website and start with its tutorial:</p><p><a href="https://reactjs.org/">React</a></p><p>If you want a quick start into React with zero configuration you can start with <a href="https://github.com/facebook/create-react-app">create-react-app</a>.</p><p>Besides React, it is quite possible that you may heard technologies like Angular or Vue.js. In fact, they have their own solutions for the same goal:</p><blockquote>Building well-structured applications efficiently</blockquote><p>Below you can find a very detailed comparison between React, Vue and Angular:</p><p><a href="https://medium.com/techmagic/reactjs-vs-angular5-vs-vue-js-what-to-choose-in-2018-b91e028fa91d">React vs Angular vs Vue.js — What to choose in 2019? (updated)</a></p><h4>— React Native</h4><p>Following by <a href="https://reactjs.org/">React</a> which is <em>a JavaScript library for building user interfaces</em>, Facebook released a framework: React Native:</p><p><a href="https://facebook.github.io/react-native/">React Native · Learn once, write anywhere</a></p><p>As you might guess from the name, it is a framework for building native mobile applications with React and Javascript. Note that this is not something like <a href="http://phonegap.com/">PhoneGap</a>, <a href="https://crosswalk-project.org/">Crosswalk</a> or any other hybrid environment that takes your web application and makes it feel like a mobile app by putting it inside a WebView.</p><p>From the official website:</p><blockquote>With React Native, you don’t build a “mobile web app”, an “HTML5 app”, or a “hybrid app”. You build a real mobile app that’s indistinguishable from an app built using Objective-C or Java. React Native uses the same fundamental UI building blocks as regular iOS and Android apps. You just put those building blocks together using JavaScript and React.</blockquote><p>What does it mean? Well, you just write your mobile application according to the rules defined by React and React Native. And your code is translated to the target platform code based on your desire. Java for Android, Objective-C for iOS.</p><p>And another great feature is the support for native code. You want to optimise some part of your application? Or you need to get close to native level due to some performance requirement? Just implement your feature with native language and use it inside React Native.</p><p>Again, singularity. One codebase for both platforms with native-like performance.</p><p>Additionally, both Angular and Vue have their own mobile frameworks in their ecosystem:</p><ul><li><a href="https://weex.apache.org/">Weex</a></li><li><a href="https://www.nativescript.org/">NativeScript</a></li></ul><h3>CONCLUSION</h3><p>Finally, i suggest you to follow some web sites to hear recent developments not only in Javascript but all development world:</p><ul><li><a href="https://www.reddit.com/r/javascript/">/r/javascript</a></li><li><a href="https://hackernoon.com/">Hackernoon</a></li><li><a href="https://medium.freecodecamp.org/tagged/web-development">Free Code Camp</a></li><li><a href="https://news.ycombinator.com/">Hacker News</a></li></ul><p>I tried to provide some basic knowledge and awareness about the current state of Javascript. There are tons of technologies and technical terms coming up everyday. It is really hard to be up to date. I just wanted to pick fundamental ones.</p><p>If you find any misleading, wrong or incomplete part please leave a comment. Any kind of feedback would be appreciated.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8b646d31e5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use Scrapy with Django Application]]></title>
            <link>https://alioguzhan.medium.com/how-to-use-scrapy-with-django-application-c16fabd0e62e?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c16fabd0e62e</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[scrapy]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Tue, 12 Sep 2017 17:46:54 GMT</pubDate>
            <atom:updated>2021-06-30T18:10:07.402Z</atom:updated>
            <content:encoded><![CDATA[<p><em>You can also read this here on my personal web site:</em></p><p><a href="https://yildiz.dev/2017/09/12/how-to-use-scrapy-with-django-application/"><em>https://yildiz.dev/2017/09/12/how-to-use-scrapy-with-django-application/</em></a></p><p>There are a couple of articles on how to integrate Scrapy into a Django Application (or vice versa?). But most of them don’t cover a full complete example that includes triggering spiders from Django views. Since this is a web application, that must be our main goal.</p><h3>What do we need?</h3><p>Before we start, it is better to specify what we want and how we want it. Check this diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*ZzTm-J_UgiuSoQtRmUoE9g.png" /></figure><p>It shows how our app should work:</p><ul><li>Client sends a request with a URL to crawl it. (1)</li><li>Django triggers Scrapy to run a spider to crawl that URL. (2)</li><li>Django returns a response to tell Client that crawling just started. (3)</li><li>Scrapy completes crawling and saves extracted data into a database. (4)</li><li>Django fetches that data from the database and return it to Client. (5)</li></ul><p>Looks great and simple so far.</p><h4>A note on that 5th statement</h4><blockquote>Django fetches that data from database and return it to Client. (5)</blockquote><p>Neither Django nor client doesn’t know when Scrapy completes crawling. There is a callback method named pipeline_closed, but it belongs to Scrapy project. We can’t return a response from Scrapy pipelines. We use that method only to save extracted data into a database.</p><p>Well eventually, somewhere, we have to tell the client :</p><blockquote>Hey! Crawling completed and i am sending you crawled data here.</blockquote><p>There are two possible ways of this (<em>Please comment if you discover more</em>):</p><p>We can either use web sockets to inform the client when crawling completed.</p><p>Or,</p><p>We can start sending requests every 2 seconds (more? or less ?) from client to check crawling status after we get the &quot;crawling started&quot; response.</p><p>Web Socket solution sounds more stable and robust. But it requires a second service running separately and means more configuration. I will skip this option for now. But I would choose web sockets for my production-level applications.</p><h3>Let’s write some code</h3><p>It’s time to do some real job. Let’s start by preparing our environment.</p><h4>Installing Dependencies</h4><p>Create a virtual environment and activate it:</p><pre>$ python3.5 -m venv venv<br>$ source venv/bin/activate</pre><p>Then install required dependencies with:</p><pre>$ pip install django scrapy scrapyd python-scrapyd-api</pre><p><a href="https://github.com/scrapy/scrapyd">Scrapyd</a> is a daemon service for running <a href="https://github.com/scrapy/scrapy">Scrapy</a> spiders. You can discover its details from <a href="http://scrapyd.readthedocs.io/en/stable/">here</a>.</p><p><a href="https://github.com/djm/python-scrapyd-api">python-scrapyd-api</a> is a wrapper allows us to talk scrapyd from our Python program.</p><blockquote>Note: I am going to use Python 3.5 for this project.</blockquote><h4>Creating a Django Project</h4><p>Create a Django project with an app named main :</p><pre>$ django-admin startproject iCrawler<br>$ cd iCrawler &amp;&amp; python manage.py startapp main</pre><p>We also need a model to save our scraped data. Let’s keep it simple:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e903c65c5551dddb408a1cba82c7585c/href">https://medium.com/media/e903c65c5551dddb408a1cba82c7585c/href</a></iframe><p>Add main app into INSTALLED_APPS in settings.py And as a final step, migrations:</p><pre>$ python manage.py makemigrations<br>$ python manage.py migrate</pre><p>Let’s add a view and URL to our main app:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfaa4ff773afca987e6a3094ed332c5b/href">https://medium.com/media/dfaa4ff773afca987e6a3094ed332c5b/href</a></iframe><p>I tried to document the code as much as I can.</p><blockquote>But the main trick is, unique_id. Normally, we save an object to database, then we get its ID. In our case, we are specifying its unique_id before creating it. Once crawling completed and client asks for the crawled data; we can create a query with that unique_id and fetch results.</blockquote><p>And an URL for this view:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1da975613fb718ea84b55ad1119b1e74/href">https://medium.com/media/1da975613fb718ea84b55ad1119b1e74/href</a></iframe><h4>Creating the Scrapy Project</h4><p>It is better if we create the Scrapy project under (or next to) our Django project. This makes easier to connect them together. So let’s create it under Django project folder:</p><pre>$ cd iCrawler<br>$ scrapy startproject scrapy_app</pre><p>Now we need to create our first spider from inside scrapy_app folder:</p><pre>$ cd scrapy_app<br>$ scrapy genspider -t crawl icrawler <a href="https://google.com/">https://google.com</a></pre><p>I name spider as icrawler. You can name it as anything. Look -t crawl part. We specify a base template for our spider. You can see all available templates with:</p><pre>$ scrapy genspider -l</pre><pre>Available templates:<br>basic<br>crawl<br>csvfeed<br>xmlfeed</pre><p>Now we should have a folder structure like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*CYNVpLHx8H6gMSkXkD91BQ.png" /></figure><h4>Connecting Scrapy to Django</h4><p>In order to have access to Django models from Scrapy, we need to connect them together. Go to settings.py file under scrapy_app/scrapy_app/ and put:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b10826454a67c8464af195f03549379d/href">https://medium.com/media/b10826454a67c8464af195f03549379d/href</a></iframe><p>That’s it. Now let’s start scrapyd to make sure everything installed and configured properly. Inside scrapy_app/ folder run:</p><pre>$ scrapyd</pre><p>This will start scrapyd and generate some outputs. Scrapyd also has a very minimal and simple web console. We don’t need it on production but we can use it to watch active jobs while developing. Once you start the scrapyd go to <a href="http://127.0.0.1:6800/">http://127.0.0.1:6800</a> and see if it is working.</p><h4>Configuring Our Scrapy Project</h4><p>Since this post is not about fundamentals of scrapy, I will skip the part about modifying spiders. You can create your spider with official documentation. I will put my example spider here, though:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7307dc0ae6eab748ab03a9af8ee2ad12/href">https://medium.com/media/7307dc0ae6eab748ab03a9af8ee2ad12/href</a></iframe><p>Above is icrawler.py file from scrapy_app/scrapy_app/spiders. Attention to __init__ method. It is important. If we want to make a method or property dynamic, we need to define it under __init__ method, so we can pass arguments from Django and use them here.</p><p>We also need to create a Item Pipeline for our scrapy project. A pipeline is a class for making actions over scraped items. From <a href="https://doc.scrapy.org/en/latest/topics/item-pipeline.html">documentation</a>:</p><blockquote>Typical uses of item pipelines are:</blockquote><ul><li>cleansing HTML data</li><li>validating scraped data (checking that the items contain certain fields)</li><li>checking for duplicates (and dropping them)</li><li><strong>storing the scraped item in a database</strong></li></ul><p>Yay! Storing the scraped item in a database. Now let’s create one. Actually, there is already a file named pipelines.py inside scrapy_project folder. And also that file contains an empty-but-ready pipeline. We just need to modify it a little bit:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0014936b6a70c863a243e37353fb4f5d/href">https://medium.com/media/0014936b6a70c863a243e37353fb4f5d/href</a></iframe><p>And as a final step, we need to enable (uncomment) this pipeline in scrapy settings.py file:</p><pre># Configure item pipelines<br># See <a href="http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html">http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html</a><br>ITEM_PIPELINES = {<br>    &#39;scrapy_app.pipelines.ScrapyAppPipeline&#39;: 300,<br>}</pre><blockquote>Don’t forget to restart scraypd if it is working.</blockquote><p>This scrapy project basically,</p><ul><li>Crawls a website (comes from Django view)</li><li>Extract all URLs from the website</li><li>Put them into a list</li><li>Save the list to the database over Django models.</li></ul><p>And that’s all for the back-end part. Django and Scrapy are both integrated and should be working fine.</p><h3>Notes on Front-End Part</h3><p>Well, this part is so subjective. We have tons of options. Personally, I built my front-end with React . The only part that is not subjective is usage of setInterval . Yes, let’s remember our options: web sockets and to send requests to server every X seconds.</p><p>To clarify base logic, this is a simplified version of my React Component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b6098e05a0a3296e50382b3337bd994/href">https://medium.com/media/1b6098e05a0a3296e50382b3337bd994/href</a></iframe><p>You can discover the details by comments I added. It is quite simple actually.</p><p>Oh, that’s it. It took longer than I expected. Please leave a comment for any kind of feedback.</p><h3>Sample Projects</h3><p>Below you can find some example implementations based on this article. If you have one, please mention it as a comment. I will keep updating this section.</p><p>This is a nice template app from <a href="https://medium.com/u/18be0eeffd4c">Adrian Castellanos Zaragoza</a>:</p><p><a href="https://github.com/adriancast/Scrapyd-Django-Template/blob/master/README.md">adriancast/Scrapyd-Django-Template</a></p><p>—</p><p>This from <a href="https://medium.com/u/db0adfaa0d21">심명훈</a> and also includes frontend part with plain Javascript. Check this out!</p><p><a href="https://github.com/copyNdpaste/scrapy-with-django">copyNdpaste/scrapy-with-django</a></p><p>—</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c16fabd0e62e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LXD — Assigning static IP to containers]]></title>
            <link>https://alioguzhan.medium.com/lxd-assigning-static-ip-to-containers-ecf558982071?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf558982071</guid>
            <category><![CDATA[lxd]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[lxc]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Wed, 24 May 2017 10:42:26 GMT</pubDate>
            <atom:updated>2021-06-30T18:16:37.503Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*Z_Wg43xclGuRNoY8v5TGxQ.png" /></figure><p><em>You can also read this here on my personal web site:</em></p><p><a href="https://yildiz.dev/2017/05/24/lxd-%E2%80%94-assigning-static-ip-to-containers/"><em>https://yildiz.dev/2017/05/24/lxd-%E2%80%94-assigning-static-ip-to-containers/</em></a></p><p>By default, lxd containers get random ip from lxd-bridge system. If you want to assign static IPs (i.e with some logical or arithmetic order), good news: It is quite simple.</p><p>All we need to do is create a DNS configuration file and tell lxd to use it.</p><p>There is a configuration file lxd-bridge under /etc/default/ directory. It is created when you first run lxd init command. It is something like this:</p><pre># WARNING: This file is generated by a debconf template!<br># It is recommended to update it by using “dpkg-reconfigure -p medium lxd”</pre><pre># Whether to setup a new bridge or use an existing one<br>USE_LXD_BRIDGE=”false”</pre><pre># Bridge name<br># This is still used even if USE_LXD_BRIDGE is set to false<br># set to an empty value to fully disable<br>LXD_BRIDGE=””</pre><pre># Update the “default” LXD profile<br>UPDATE_PROFILE=”true”</pre><pre># Path to an extra dnsmasq configuration file<br><strong>LXD_CONFILE=””</strong></pre><pre># DNS domain for the bridge<br>LXD_DOMAIN=”lxd”</pre><pre># IPv4</pre><pre>## IPv4 address (e.g. 10.0.8.1)<br>LXD_IPV4_ADDR=”10.0.8.100&quot;</pre><pre>## IPv4 netmask (e.g. 255.255.255.0)<br>LXD_IPV4_NETMASK=”255.255.255.0&quot;</pre><p>Look that LXD_CONFILE. It is empty by default. We are going to put our configuration file’s path here. Let’s say we have 3 containers:</p><ul><li>web_server</li><li>web_apps</li><li>sip_server</li></ul><p>Now create a file named dns.conf under /etc/default/ directory:</p><pre>$ sudo nano /etc/default/dns.conf</pre><p>Put these lines in it:</p><pre>dhcp-host=web_server,10.0.8.99<br>dhcp-host=web_apps,10.0.8.100<br>dhcp-host=sip_server,10.0.8.101</pre><p>The syntax is dhcp-host=container_name,ip_address.</p><p>Now update /etc/default/lxd-bridge file:</p><pre># Path to an extra dnsmasq configuration file<br><strong>LXD_CONFILE=”/etc/default/dns.conf”</strong></pre><p>That’s it. To make our changes work, we need to restart lxd-bridge service:</p><pre>$ sudo service lxd-bridge restart</pre><p>We may need to reboot each container to take their new ip address:</p><pre>$ lxc exec web_server /bin/bash<br>root@web_server:$ reboot</pre><p>Now each container will have static ip based on our dns.conf file even if you reboot the system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf558982071" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native Maps with Google Directions Api]]></title>
            <link>https://alioguzhan.medium.com/react-native-maps-with-google-directions-api-bc716ed7a366?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc716ed7a366</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[google-directions-api]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react-native-maps]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Sat, 20 May 2017 13:44:03 GMT</pubDate>
            <atom:updated>2021-06-30T18:15:43.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DVkLFr953djSo0q6cA0-kg.png" /></figure><p><em>You can also read this here on my personal web site:</em></p><p><a href="https://yildiz.dev/2017/05/20/react-native-maps-with-google-directions-api/"><em>https://yildiz.dev/2017/05/20/react-native-maps-with-google-directions-api/</em></a></p><p>We have to use an external service to draw real world directions between two (or more) locations on the Map. For React Native, i ended up using both <strong>react native maps</strong> and <strong>Google Directions Api</strong>.</p><h4>React Native Maps</h4><p>Thanks to folks at <a href="http://airbnb.io//">airbnb</a>, we have <a href="https://github.com/airbnb/react-native-maps">react-native-maps</a>: A complete set of React components for Maps. You can check features and details from Github repo:</p><p><a href="https://github.com/airbnb/react-native-maps">airbnb/react-native-maps</a></p><h4>Google Directions Api Service</h4><p>Google provides <a href="https://developers.google.com/maps/documentation/directions/start">Directions API</a> that calculates directions between locations. Since It is an api-based service, there is no SDK for any platform (not officially at least)</p><h4>Before Start Coding</h4><p>The JSON response returned from Directions Api contains a key named overview_polyline which is an <a href="https://developers.google.com/maps/documentation/utilities/polylinealgorithm">encoded polyline</a> looks like this:</p><pre>cxftF{xcpDEt@Kj@Gf@E`C@~@XtAJb@Jh@@J@D?F@HA\Ip@Ox@KZKh@?PAB@D?H?B@F@B?F@@@DBBBD@@B@@@B@D@B@D?L@v@FFBXDpFxA|@l@^d@z@~BVz@Nf@Ph@DNFLLXVZxArAh@b@l@d@r@l@pAzAl@z@PXBF@FBD@F@F?H?D@JCLCHA@A@A@A@C@IBQBKAYIWSMKKMGKOOMIo@D]FSBi@JSDUAs@Qm@WcBk@s@U[K_@Sq@e@OUMWKQMUKMIGMGICC?E?K?E@QHUNm@Xq@XYLa@Ls@LYDW@SDGBG@IHS\Wl@EFA@A@CDEDEBG@C@[?e@Ca@KQGa@QSC_@?Y@k@Fu@As@?U@I@I@IBEBQH]Lq@\WLuBx@i@Vy@TaANK@E@QAICUKIGMM]e@OWISEOCSAMAG</pre><p>This is the data we are going to use to create our route on the map. But first we need to decode it. There is a small library from <a href="https://www.mapbox.com/">MapBox</a> team named Polyline:</p><p><a href="https://github.com/mapbox/polyline">mapbox/polyline</a></p><p>We can use this library to encode / decode polylines.</p><h4>Example App</h4><p>Create a new react native app:</p><pre>$ react-native init RnDirectionsApp</pre><p>Inside RnDirectionsApp folder, install react-native-mapsand polyline :</p><pre>$ npm install react-native-maps @mapbox/polyline --save<br>$ react-native link</pre><blockquote>You can find more detailed installation guide here at <a href="https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md">Github Repo</a></blockquote><p>Now we have an empty but ready react-native app. Let’s first see our getDirections method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d707a0fe75a6b70b9fe5a739f18d20fd/href">https://medium.com/media/d707a0fe75a6b70b9fe5a739f18d20fd/href</a></iframe><p>Simply, this method:</p><ul><li>Fetches directions data from Google (line 4)</li><li>Decodes encoded polyline data ( line 6 )</li><li>Converts decoded polyline data into a list of objects (line 7)</li><li>Updates state with new coords data</li></ul><p>Now we can draw our route on the map. To do this, We can use MapView.Polyline from react-native-maps. In our render method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48f7a6e5b45df70405892a85a599e379/href">https://medium.com/media/48f7a6e5b45df70405892a85a599e379/href</a></iframe><p>You can find more info on detailed usage of Mapview.Polyline <a href="https://github.com/airbnb/react-native-maps/blob/master/docs/polyline.md">here</a>.</p><p>And this is full version of index.ios.js :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77a35fc468f071933e750edada29c75a/href">https://medium.com/media/77a35fc468f071933e750edada29c75a/href</a></iframe><p>Hope this helps. Please leave a comment for any kind of feedback</p><p><strong>UPDATE: </strong><a href="https://www.bram.us/">Bram Van Damme</a> created a component based on this post. Looks promising. You can check it from here:</p><p><a href="https://github.com/bramus/react-native-maps-directions">bramus/react-native-maps-directions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc716ed7a366" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hangi Programlama Dilini Öğrenmeliyim ?]]></title>
            <link>https://alioguzhan.medium.com/hangi-programlama-dilini-%C3%B6%C4%9Frenmeliyim-d49b8c25eb1c?source=rss-6b8b105c48c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d49b8c25eb1c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programlama]]></category>
            <category><![CDATA[kodlama]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ali Oğuzhan Yıldız]]></dc:creator>
            <pubDate>Fri, 05 May 2017 12:33:26 GMT</pubDate>
            <atom:updated>2021-06-30T18:14:54.641Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LnB7Vdhn2aS6VgOAWFCOcg.png" /><figcaption>Resim Kaynağı: <a href="https://crossbrowsertesting.com/blog/">https://crossbrowsertesting.com/blog/</a></figcaption></figure><p><em>İsterseniz bu yazıyı aşağıdaki adresten de okuyabilirsiniz:</em></p><p><a href="https://yildiz.dev/2017/05/05/hangi-programlama-dilini-ogrenmeliyim/"><em>https://yildiz.dev/2017/05/05/hangi-programlama-dilini-ogrenmeliyim/</em></a></p><p><em>Son güncelleme: Ekim 2020</em></p><p>Bir soru. Çevremde bir çok insan tarafından mütemadiyen sorulan bir soru. Soruyu soran şahıs farkında olmasa da, aslında bu soruyu sorarkenki asıl amacı spesifik olarak bir programlama dilini öğrenmek değil. Asıl öğrenmek istediği;</p><blockquote>Ben bu işi öğrenmek ve bu alanda çalışmak istiyorum. Nereden başlamalıyım?</blockquote><p>sorusunun cevabı. Evet;</p><p>Bu işe başlamak isteyenler ya da yeni başlamış olanlar için bir <strong>roadmap</strong> niteliğinde olmasını umut ettiğim satırlarıma başlamadan önce fon müziği olarak arkada çalabilecek bir parça hazır bulunsun:</p><ul><li><a href="https://www.youtube.com/watch?v=0SqFPNTBnv8">Youtube Linki</a></li><li><a href="https://open.spotify.com/track/1dtfTodJ3Uld533EXKQokC">Spotify Linki</a></li></ul><blockquote>2006 yılında, lisede, sınıftaki sevdiğim bir kız arkadaşımın doğum günü vardı. Hediye alacak param olmadığından mütevellit, o zamanlar yeni yeni merak duymaya başladığım programlama ile ilgili bi` şeyler yapmaya karar verdim. Kafamdaki plan, kızın doğum gününü kutlayan bir bilgisayar programı yazmaktı. ADSL bile olmayan internet bağlantım üzerinden, doğru düzgün ingilizce bilmediğim için, türkçe sitelerden bu işi nasıl yaparım diye araştırmaya başladım. Sonuç olarak <strong><em>Visual Basic 6.0</em></strong> diye bir programlama dili buldum. 1–2 hafta inceledikten sonra programı yazmaya başladım.</blockquote><blockquote>Bitirdiğimde; pembe bir arkaplana sahip, ortasında uzun bir doğum günü mesajı olan, sağda solda üzerine basıldığında sempatik (ya da ergence) kutlama mesajları gösteren butonların olduğu bir Windows programı ortaya çıkmıştı.</blockquote><p>En son o arkadaşımla konuştuğumda (3–4 yıl önce), hala saklıyordu cdyi. Bu, ciddi (!) anlamda yaşadığım ilk programlama tecrübesiydi.</p><p>Eğer ingilizce bilseydim ve beni doğru kaynaklara yönlendirebilecek bir tanıdığım olsaydı, Visual Basic 6.0 nın, son sürümü 1998 yılında yayınlanmış ve artık neredeyse kullanılmayan bir dil olduğunu bilirdim; onun yerine çok daha yeni bir teknoloji olan .NET teknolojisinde yazabilir ya da masaüstü programı yerine bir web uygulaması yazabilirdim.</p><p>Konudan bağımsız olarak;</p><blockquote>Ya da hiç bunlarla uğraşmayıp; babamdan 50 lira alıp adam gibi bir doğum günü hediyesi de alabilirdim.</blockquote><p>İlk bölümden çıkarılacak ders;</p><blockquote>İngilizce Öğrenin ( Ya da ailenizden para istemeyi öğrenin )</blockquote><p>Yazının bundan sonraki kısmına ingilizce bildiğinizi varsayarak devam ediyorum. Aşağıdaki paragrafı anlamakta zorluk çekiyorsanız ingilizce eksiğiniz olabilir. Yine de merak ediyorsanız devam edebilirsiniz tabii ki.</p><p>MIT — Introduction to Computer Science and Programming:</p><blockquote>Now, this course is primarily aimed at students who have little or no prior programming experience. As a consequence, we believe that no student here is under-qualified for this course: you’re all MIT students, you’re all qualified to be here. But we also hope that there aren’t any students here who are over-qualified for this course. And what do I mean by that? If you’ve done a lot prior programming, this is probably not the best course for you, and if you’re in that category, I would please encourage you to talk to John or I after class about what your goals are, what kind of experience you have, and how we might find you a course that better meets your goals.</blockquote><h4>Peki hangi programlama dili ?</h4><p>Bu sorunun cevabını net olarak veren uluslararsı bir komite ya da otorite yok. Herkes farklı bir cevap verebilir. Ya da herkes kendi başladığı programlama dilini önerebilir. O yüzden, biraz olsun objektif bir sonuca ulaşmak için bu alandaki büyük okulların müfredatlarına bakabiliriz.</p><p>M.I.T (massachusetts institute of technology), uzun yıllardır, programlamaya giriş ve algoritma derslerini <strong>Python</strong> üzerinden vermektedir.</p><p>Ülkemizde de <strong>Koç Üniversitesi</strong> bu dersleri <strong>Python</strong> üzerinden vermekteymiş. (Askerdeyken oradan mezun bir arkadaşım söylemişti. Onun yalancısıyım)</p><p>Eğitim kurumlarının yanı sıra, internette de kısa bir araştırma yaparsanız, bir çok web sitesinden bir çok programcı ve blogger ın <strong>Python</strong> ve <strong>Javascript</strong> gibi yüksek seviyeli dilleri işaret ettiğini görürsünüz. Bu dillerin en büyük avantajı , gerçekten yüksek seviyeli diller oldukları için, sizi <strong>Memory Management, Garbage Collection, Thread, Stack, Pointer</strong> gibi nispeten low level kavramlarla mümkün olduğunca az muhattap etmesidir.</p><p>Mesela aşağıda neden Python’un başlangıç olarak muazzam olduğunu anlatan güzel bir blog yazısı var:</p><p><a href="http://blog.trinket.io/why-python/">Why Python is a Great First Language - Trinket Blog</a></p><pre>print(&quot;Hello, World&quot;)</pre><p>Yukaridaki, en basit ve en kısa python programlarından birisidir. Ekrana Hello World yazdırır. Aynı işi yapan kodu Java da yazmak istediğinizde ise;</p><pre>public class HelloWorld {<br>    public static void main(String[] args) {<br>        System.out.println(“Hello, World”);<br>    }<br>}</pre><p>Şimdi, yeni başlayan birisi bu kodu yazdıktan sonra sırasıyla şunları soracak:</p><ul><li>public ne?</li><li>class ne?</li><li>static ne işe yarar?</li><li>void ne demek?</li><li>neden main yazdık ?</li></ul><p>Daha da uzar bu liste. Ama Python’da yazdığımız kodu açıklaması çok daha kısa sürer. Özellikle öğrenme aşamasındayken; yazdığımız kodun tam olarak ne işe yaradığını , ne iş yaptığını bilmezsek ileride daha büyük sıkıntılara yol açabilir. <strong>O yüzden ilk öğrenme aşamasında mümkün olduğunca basit ve yüksek seviyeli bir dil seçerek, programlamanın temellerini kavramak daha mantıklı olacaktır. Bu, aynı zamanda süreci de hızlandıracaktır.</strong></p><blockquote><strong>2020 Notu</strong>: Son cümlemi artık destekleyemiyorum. Bazı insanlar hala doğru bulabilir ama:</blockquote><blockquote><strong>Yüzeysel de olsa</strong> bilgisayarın ve programlama dillerinin nasıl çalıştığına dair bilgi edinmek faydalı olabilir. Tam olarak anlamasanız bile sonrasında öğreneceğiniz Python gibi yüksek seviyeli dillerde bazı özelliklerin bize nasıl bu kadar kolay ve basit olarak sunulduğuna dair fikir sahibi olmanızı sağlayacaktır. O yüzden bir sonraki kısımda değindiğim CS50 kursu bu noktada daha çok önem kazanıyor.</blockquote><h4>CS50: Introduction to Computer Science and Art of Programming</h4><p>Eğer:</p><blockquote>Ben öğrenme aşamasında nispeten düşük seviyeli kavramları es geçmek istemiyorum. Kolay bir dile ile başlarsam sonrasında bu kavramlara dönmek benim için daha zor olabilir. O yüzden en başından öğrenmem gereken her şeyi öğrenmeyi tercih ederim.</blockquote><p>diyorsanız, bunun için de gerçekten çok kaliteli bir kaynak var:</p><p><a href="https://cs50.harvard.edu/x/2020/">CS50x</a></p><p>CS50, Harvard Üniversitesi’nde öğretilen bilgisayar bilimleri dersidir. Online olarak bulunur. Her dersi ve her ödevi dünyanın her yerinden her insana açıktır. Hatta dönem sonunda sertifika bile alabilirsiniz. Bu kursun müfredatı içinde de Python var. Ama Python öğretmeden önce ilk 4–5 hafta size C programlama dili üzerinden bilgisayar nedir, nasıl çalışır, memory nedir, veri yapıları ve algoritmalar nelerdir gibi kavramları açıklıyor.</p><blockquote>Not: Başlangıç olarak bu kursu atlayıp direkt olarak python ile başlasanız bile sonrasında bu kursu tamamlamayı kesinlikle tavsiye ediyorum. Dersi anlatan <strong>David J. Malan </strong>karışık konuları çok güzel açıklayabiliyor. Çok güzel bir anlatım tekniği var. Kafanızda neredeyse hiç soru işareti kalmıyor.</blockquote><h4>Sektöre Hazırlanmak</h4><p>Profesyonel olarak bir firmada çalışamaya başlamadan önce, öğrenme sürecinde bazı küçük projeler geliştirebilirsiniz. Bu sayede başvurduğunuz firmalara gösterebileceğiniz bir tecrübeniz olur.</p><p>Yukarıda bahsettiğim CS50 kursunu bitirdiğinizde, sadece kursun ödevlerinden oluşan projeleriniz olacaktır. C, Python, Javascript, HTML, CSS, SQL gibi teknolojilerin hepsine ucundan da olsa dokunup ortaya bir şeyler çıkarmış olacaksınız.</p><p>Onun dışında, Python, Ruby ve Javascript gibi diller, kolaylıkla, hem masaüstü hem de web tabanlı uygulamalar hazırlamanıza olanak sağlar. Özellikle Web Programlama, öğrenme sürecini daha eğlenceli bir hale getirecektir.</p><ul><li>Flask [Python]</li><li>Django [Python]</li><li>Rails [Ruby]</li><li>Node.js [Javascript]</li></ul><p>Yukarıdaki listede bu 3 ayrı dil ile Web uygulamaları hazırlamanızı sağlayan teknolojiler listelenmiştir. İlgili kelimeleri google da aratarak kendinize bir başlangıç noktası sağlayabilirsiniz. [Unutmayın, ingilizce kaynaklar.]</p><h4>Bundan sonra ne olacak ?</h4><p>Asıl olay şimdi başlıyor. Beğendiğiniz dil ile 2–3 ay vakit geçirdikten sonra artık programlamanın temel mantığına neredeyse hakimsiniz. Artık kendinize ilerisi için yol seçmeniz gerekmekte. Bu yolu seçmeye de aşağıdaki soruyla başlayabilirsiniz:</p><blockquote>Ben ne programcısı olacağım ?</blockquote><p>Envai çeşit programlama alanı var. Bazıları:</p><ul><li>System Programming</li><li>Mobile Programming</li><li>Web Programming</li><li>Game Programming</li><li>Desktop Programming</li></ul><p>En az 10 gününüzü ayırıp bu başlıkların her birisini tek tek araştırın. Nedir, ne değildir, ne iş yaparlar, örnek projeler, örnek kodlar, programlama dilleri nelerdir, o alan için bi ön gereksinim var mı (Mesela Oyun Programlama için ortalamanın üzerinde bir fizik bilginizin olması büyük avantaj sağlar) vs.</p><p>İstediğiniz alana karar verdikten sonra direkt olarak bu alanda araştırmaları arttırın. Örnek projelere ve kodlara daha çok bakın. Bu alandaki başarılı adamların kitaplarını ve bloglarını okuyun.</p><p>Alanınızda çalışmaya ve öğrenmeye başladıktan 1–2 sene sonra kendinize <strong>Junior Developer</strong> diyebilirsiniz. Junior, IT dünyasında Bilgisi var ama tecrübesi yok anlamına gelen, şirin bir sıfattır.</p><p>Tam bu noktada sizi, yetiştirmek üzere işe alma cesaretini ve büyüklüğünü gösteren bir yazılım firması bulabilirseniz hayırlı uğurlu olsun. Bu şansı iyi değerlendirin ve profesyonelliğe ilk adımınızı atın.</p><p>Bir kaç maddeyle toparlayıp bitirelim:</p><ul><li>Herhangi bir şeyi öğrenmenin en kolay ve etkili yollarından birisi örnek yapmaktır. Mobil programlamaya karar verdiyseniz, elinizdeki Android / iOS telefonunuza kurup çalıştırabileceğiniz bir uygulama yazın. Ekranda sadece merhaba bile yazsa o sizin ilk uygulamanız olacak. Saklayın onu. Web Programlamaya merak duyduysanız, bir blog sitesi yazabilirsiniz.</li><li>Yukarıda bahsettiğimiz yüksek seviyeli nispeten basit diller ile bir kere olayın mantığını kavradığınızda hepsi gözünüze aynı gelecek. Bir noktadan sonra daha önce hiç kod yazmadığınız bir dilde kod yazmanız gerekse bile, bir kaç saatlik döküman incelemesinden sonra, yavaş da olsa, ortaya bir şeyler çıkartabilirsiniz.</li><li>Copy / Paste programcısı olmayın. İnternetten işinize yarayacak bir kod parçası aldıysanız bile ( ki alabilirsiniz bunda sorun yok ) aldığınız kodun ne iş yaptığını ve nasıl çalıştığını anlayın. Sonraki kullanımlarda bu kodu kendiniz yazmaya çalışın.</li><li>Piyasadaki binlerce lira para isteyen kurslara gitmeyin. Oralara vereceğiniz para ve zamanla kendinizi, doğru kaynaklarla, çok daha iyi yetiştirirsiniz.</li><li>Dünyada sadece c# ve java yok.</li><li>Üniversitelerimizin çoğunun c# ve java öğretiyor olması bu gerçeği değiştirmez.</li><li>Ülkemizdeki iş ilanlarının çoğunda c# ve java bilen adam aranması da iki yukarıdaki gerçeği değiştirmez.</li><li><strong><em>c# ve java kötü programlama dilleri DEĞİLDİR.</em></strong> Sadece başlangıç için ideal değiller. Olayın temelini kavradıktan sonra pekala kariyerinizi bu dillerden birisinin üzerine kurabilirsiniz.</li></ul><h4>Git ve Github Hesabı</h4><p>Gerek aldığınız kurslar dahilinde, gerekse de kendi araşatırmalarınız sonucunda bu noktaya kadar irili ufaklı bir sürü uygulama yapmış olmanız gerekiyor. Bu uygulamalar bilgisayarınızda durduğu sürece kimseye bir faydası yok. Dünyaya açmak, insanlarla paylaşmak gerekir.</p><p>Hala üye olmadıysanız Github’a üye olun. Kendinize bir hesap açın:</p><p><a href="https://github.com/">GitHub · Change is constant. GitHub keeps you ahead.</a></p><p>Github git teknolojisi üzerine kurulu, insanların ve firmaların kodlarını depoladığı, diğer insanlarla paylaştığı, geri bildirim verdiği ve aldığı bir platformdur. Buraya girmeden önce kısaca git nedir, ne işe yarar, nasıl kullanılır diye araştırmanızda fayda var. Burada <a href="https://medium.com/u/82d161f1a65d">Emrullah Lüleci</a> nin konuya dair güzel bir anlatımı var:</p><p><a href="https://medium.com/@emrullahluleci/git-ve-github-nas-l-kullan-l-r-7d3cc886b77e">Git ve GitHub nasıl kullanılır</a></p><p>Daha detaylı ve teknik bilgiler için ingilizce kaynaklara bakmanızda fayda var.</p><p>Yazdığınız her kodu ve her programı, hatasıyla, günahıyla sevabıyla buraya yükleyin. Sadece yazdığınız kodları değil aldığınız dersler sırasında aldığınız notları içeren bir repository bile açabilirsiniz. Kısacası programlamayı öğrenme sürecinize dair her detayı buraya yükleyebilirsiniz.</p><ul><li>Fikir sahibi yapması açısından <a href="https://github.com/alioguzhan">https://github.com/alioguzhan</a> adresinde benim Github profilimi görebilirsiniz.</li></ul><p>Son olarak; bu, zorlu ama bir o kadar da eğlenceli, yolculuk süresince sık sık bakmanızı tavsiye ettiğim bir kaç web sitesi:</p><ul><li><a href="http://stackoverflow.com/">Stackoverflow</a> → Kod yazarken takıldığınız bir nokta %99 ihtimalle bu sitede daha önce sorulmuştur ve cevabı verilmiştir. Sorunuz olmasa bile düzenli olarak girip postları inceleyin. Çok faydalı.</li><li><a href="https://www.reddit.com/r/programming/">/r/programming</a> → Güncel haberler, makaleler, sorular ve blog yazıları.</li><li><a href="https://www.reddit.com/r/Python/">/r/python/</a> → Python diliyle ilgili gelişmeler, duyurular, sorular vs.</li><li><a href="https://news.ycombinator.com/">Hacker News</a> → Yukaridaki gibi ama sadece programlamaya ozel değil. Genel olarak neredeyse bütün IT dunyasının haberleri buraya düşer.</li><li><a href="https://cs50.harvard.edu/x/2020/">https://cs50.harvard.edu/x/2020/</a> → Harvard Computer Science Dersleri. Sadece videolar değil aynı zamanda ders notları, ödevler ve yardımcı videolar gibi birçok kaynak var.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d49b8c25eb1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>