<?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 VirKill on Medium]]></title>
        <description><![CDATA[Stories by VirKill on Medium]]></description>
        <link>https://medium.com/@virkill?source=rss-d95d04a18afa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*shj3b4fTtNbXSUGOWf9LhA.jpeg</url>
            <title>Stories by VirKill on Medium</title>
            <link>https://medium.com/@virkill?source=rss-d95d04a18afa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 12:00:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@virkill/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[Choosing the right Tech for your startup]]></title>
            <link>https://medium.com/@virkill/choosing-the-right-tech-for-your-startup-78dab423de8c?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/78dab423de8c</guid>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Thu, 22 Aug 2019 04:38:41 GMT</pubDate>
            <atom:updated>2019-08-22T04:38:41.482Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ItGd7Itb99Cr6rE4qVD8wg.png" /><figcaption><a href="https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f">https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f</a></figcaption></figure><p>Choosing the right tech stack might make or break your tech startup. Apparently, this is easily overlooked and I witness too many early-stage tech startups failed or need to pay an expensive cost for this reason. When we have a solo developer who proficient and productive in one language or technology, then most of the time that’s the best option. But when we have the freedom to choose which programming language or stack, in the beginning, choosing the right technology is crucial.</p><blockquote>There’s a lot of angles to be considered, and “popularity” and “performance” unfortunately are the major factor people use to consider. Just because big tech startup uses language “x” often is the worst reason.</blockquote><p>Big tech company usually have a very specific problem related to scalability or modularity. That’s not the case with an early-stage startup where their focus should be productivity and time to market. This is why “popularity” is not a really valid reason to be considered. The most popular stack is not necessarily the best indicator. Finding the developer might be easier but as long as there’s a reasonable resource to learn, any good developer can pick up almost any technology these days.</p><p>Performant language or stack is rarely hand-in-hand with productivity. Building Single Page Application, while it is performant is usually overkilled for an MVP. It takes longer to build, it needs to keep up with updates, and hard to get it right. Going microservice architecture also creates another pitfall which leads to the necessity of bigger tech team, and longer delivery time and it hurt when the business still struggles to find the market fit for the product.</p><p>Tech startup usually races with time and available budget. And while developers are generally expensive, productivity and maintainability supposed to be the most aspect to be considered.</p><p>This paper published in 2017 tries to measure Economic Metric Across over 70 Programming language on which one provides more economic value per hour on average.</p><p>TLDR: The higher the language from the machine language tends to bring more economic value per hour.</p><p><a href="https://www.ifpug.org/wp-content/uploads/2017/04/IYSM.-Thirty-years-of-IFPUG.-Software-Economics-and-Function-Point-Metrics-Capers-Jones.pdf">https://www.ifpug.org/wp-content/uploads/2017/04/IYSM.-Thirty-years-of-IFPUG.-Software-Economics-and-Function-Point-Metrics-Capers-Jones.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78dab423de8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tech startup vs process]]></title>
            <link>https://medium.com/@virkill/tech-startup-vs-process-c669d8180b73?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c669d8180b73</guid>
            <category><![CDATA[lean-ux]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[lean-startup]]></category>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Thu, 01 Aug 2019 00:24:58 GMT</pubDate>
            <atom:updated>2019-08-01T00:24:58.104Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECEwUpioFP_mGz_E5LOC4A.jpeg" /></figure><blockquote>The more process you have, the less talent you have. The less talent you have, the more process you need.</blockquote><p>(Reed Hasting of Netflix as quoted by Bill Scott in one of his lecture about Lean UX)</p><p>I used to work for Allianz where my role was to evaluate the operational business process and SOP to see if there’s any room for improvement and automation. It almost hardwired in me and most people that, process (procedure, SOP, and the like) is good for the company. No question asked.</p><p>But as I grow into a typical “move fast, break things” software developer, and live trough various tech startup culture, I develop a certain sense against the process, like a kid against their vegetable. I hate it, many good programmers hate it, but nobody says anything because its “the right thing to do”.</p><p>It’s getting harder and harder to ship new feature out because of series of design review, user behavior analysis, 4 different QA process where each of them could potentially delay or throw the entire feature out the window.</p><p>At tech startup organization you started by aggressively ship product and features. Then the organization start brings a lot of experienced people from the corporate world to “teach” how things should be organized, introducing a lot of processes.</p><p>It’s not an uncommon story where the process creation started to happened just for the sake of making a process. They didn’t aware how it could paralyze the product pipeline and extend the product iteration lifecycle, or even worse: paralyze product shipment and innovation.</p><p>So generally its a good idea to grow a skepticism every time a new process is introduced. We can also grow several strategies around it to make the process less necessary.</p><p>For example, it is beneficial to try to have as few as possible in the team. Hire the best people we can find. When we have good people, we don’t need many people and less communication problem. We don’t waste time in the communication chain. And when we have good people, we can trust them to make a decision, cut down the standard process, and have a quicker iteration.</p><p>After all, we working in a tech industry where innovation is the heart.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c669d8180b73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mengalahkan kecepatan request per second Google dengan droplet termurah digitalocean (powered by…]]></title>
            <link>https://medium.com/@virkill/mengalahkan-kecepatan-request-per-second-google-dengan-droplet-termurah-digitalocean-powered-by-d31c70360781?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d31c70360781</guid>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Thu, 28 Feb 2019 04:33:54 GMT</pubDate>
            <atom:updated>2019-02-28T05:09:22.896Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mengalahkan kecepatan request per second Google dengan droplet termurah digitalocean (powered by Erlang).</h3><blockquote>Sebelum diprotes para Devops, perlu dibuat disclaimer dulu bahwa ini tentu tidak 100% Apple to Apple. Tapi konteksnya akan coba dijelaskan sejelas mungkin.</blockquote><p>Berawal dari keisengan membuat <a href="https://github.com/virkillz/hash_color_avatar_elixir">elixir library</a> untuk generate SVG avatar yang support Colour hash dan generate inisial nama, perlu rasanya untuk sekalian dibuatkan websitenya agar bisa digunakan bagi siapapun yang membutuhkan. Jadi harapannya developer manapun dengan bahasa pemrograman apapun bisa menggunakan fitur itu. <br> <br> Contoh layanan gratis yang sudah ada adalah : <a href="https://ui-avatars.com/">https://ui-avatars.com/</a>.<br> <br> Yang bisa kita improve dari layanan tersebut adalah:</p><ol><li>Kita bisa membuat hash function untuk memberikan warna background yang unik, tergantung nama yang diberikan.</li><li>Alih alih mengghasilkan PNG, idealnya kita bisa men-generate SVG agar lebih cepat waktu loading dan tidak pecah saat diperbesar.</li><li>Idealnya menyediakan beberapa style yang berbeda.<br> <br> Hasilnya bisa kita lihat di : <a href="http://avatar-api.org/">http://avatar-api.org</a></li></ol><p>Untuk menggunakannya kita tinggal melempar paramerter seperti name, size, set, color terhadap <a href="https://avatar-api.org/avatar.svg">https://avatar-api.org/avatar.svg</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9t5DrRDofxpnGTrVnGSmAw.png" /><figcaption>Contoh avatar yang dihasilkan</figcaption></figure><p>Karena ini layanan gratis dan (sebisa mungkin) tanpa iklan, kita akan menggunakan cloud vm paling murah yang disediakan oleh Digital Ocean. Dengan 5$ kita mendapat mesin 1 core dan RAM 500 MB. <br> <br> Kebetulan, di kantor kita sedang melakukan banyak <em>benchmarking</em> karena kita lagi mencoba me-<em>rewrite legacy api</em> menggunakan golang. Kenapa Golang? Karena mendapatkan programmer yang memiliki pengalaman di Golang relatif lebih mudah, sementara Erlang jauh lebih sulit. <br> <br> Meskipun dalam banyak <em>benchmark</em> menunjukkan hasil performance yang seimbang antara Golang dan Erlang, Erlang process menggunakan lebih banyak CPU. Golang lebih portabel, lebih mudah ditempatkan di mana mana, memiliki <em>footprint</em> yang kecil setelah di<em>compile</em>. Sementara Erlang? Aplikasi Erlang hanya berjalan di Erlang Virtual Machine, seperti Java yang hanya bisa berjalan di JVM. Nah, VMnya lah yang ngurus segala hal sehubungan dengan manajemen<em> resources</em> sehingga membuat dia hampir tidak bisa mati. Sementara itu Golang bergantung pada tekhnologi lain untuk bisa hidup kembali saat crash seperti Kubernetes.</p><p>Sama seperti Java Virtual machine yang bisa ditulis pake bahasa lain seperti Clojure, Erlang VM bisa ditulis menggunakan beberapa bahasa seperti LFE, MLFE, dan Elixir. Kita menggunakan Elixir karena syntaxnya yang lebih manusiawi.</p><h3>Aplikasi</h3><p>Kita tidak ingin melakukan benchmark hanya sebatas mengeluarkan static output semacam “<em>hello world</em>” (dan di <em>hit</em> dari <em>localhost</em>) seperti yang banyak dilakukan <em>benchmark</em> lain. Di paragraf berikut kita akan menjelaskan apa yang terjadi saat setiap <em>request</em> diterima oleh server.</p><p>Setiap user melakukan <em>request </em>ke <a href="https://avatar-ui.org/avatar.svg">Https://avatar-ui.org/avatar.svg</a>, berikut dengan parameter-parameternya, sistem akan melakukan <em>parsing parameter</em>, dan jika tidak ditemukan maka <em>default options</em> seperti <em>color, size</em> dan <em>text</em> akan digunakan. Ada beberapa operasi matematika yang kemudian dilakukan agar proporsi <em>border, text</em>, dll sesuai dengan ukuran yang diberikan. Men-<em>generate</em> inisial nama juga memerlukan beberapa operasi pada <em>string</em>. Terakhir, untuk men-<em>generate</em> warna, dilakukan operasi <em>hash</em> (md5), diambil beberapa karakter pertama, di-<em>convert</em> semua menjadi angka, dikalikan satu sama lain, dan dimasukkan dalam fungsi rem(359) agar hasil akhirnya tidak lebih dari 359 (sesuai dengan <em>hue range</em>), semua hasil operasi ini dimasukkan kedalam template SVG sesuai yang dipilih.<br> <br> Kesimpulannya: meskipun tidak berhubungan dengan database, operasi yang dilakukan untuk setiap request bukanlah hal yang trivial.</p><p><em>Deployment</em> dan <em>Optimisasi Server</em><br> Tiba saatnya <em>deployment</em>. Sesuai yang sudah disebut diatas, kita akan men-<em>deploy</em> aplikasi ini ke dalam Ubuntu Server 1 Core dengan Memori 512 MB seharga 5$ per bulan dari Digital Ocean. Walaupun idealnya kita meng-<em>compile</em> sebagai BEAM <em>release</em>, kali ini kita hanya menjalankan <em>mix</em> dengan <em>ENV=production</em> ini memastikan tidak ada proses yang tidak perlu seperti <em>live reloading</em> yang hanya berguna pada <em>development environtment</em>. Dan walaupun sebenarnya Erlang VM mampu jalan bagus tanpa webserver tambahan, kita gunakan Nginx untuk dijadikan <em>reverse proxy</em> serta agar konfigurasi <em>letsencrypt </em>menjadi lebih mudah.</p><p>Beberapa optimisasi juga dilakukan. Dari sisi Erlang VM, kita set logger menadi <em>error only</em>. Dari sisi Nginx, gzip kita matikan. Ini karena target file keluaran kita adalah 400 byte atau dibawah 1 Kb. Jika Gzip kita aktifkan untuk <em>output</em> sekecil ini maka akan memperlambat proses dan justru menambah ukuran file karena ada metadata yang dilampirkan.</p><h3>Metode testing</h3><p>Kita akan simulasikan ribuan user mengakses <em>url</em> tersebut di saat yang bersamaan. Agar adil, requestnya tidak melalui <em>localhost</em>. Baik server yang di test atau melakukan serangan berada di region yang sama (Singapore). Selagi target ada di Digital Ocean, Server penyerang ada di Google Cloud Platform dengan kekuatan 4 Core. <br> <br> Mengenai testing tool yang digunakan, ada beberapa yang bisa dijadikan pilihan. Secara default kita punya Apache Benchmark. Tapi konon AB tidak menggunakan semua core yang ada. Ada juga Jmeter yang berbasis GUI. Ada locust tapi kesulitan saat harus menghitung sendiri TPS ideal berdasarkan failed ratenya. Kali ini kita akan menggunakan wrk. Wrk banyak digunakan karena cukup praktis untuk mendapatkan gambaran ketahanan server. Wrk secara sederhana hanya menghitung berapa request yang sukses lalu dibagi durasi waktu penyerangan. Lebih simpel karena kita langsung mengetahui berapa maksimum Request per Second yang mampu dihandle sebuah server. Ada juga informasi mengenai <em>latency</em> dan berapa ukuran file yang dihasilkan di setiap request.<br> <br> Command option yang digunakan :</p><blockquote>wrk -t8 -c50 -d10s url-tujuan</blockquote><p>Artinya kita menggunakan 8 thread, masing2 mencoba spawn 50 koneksi secara bersamaan dan dilancarkan selama 10 detik. Semua website yang kita test akan menggunakan setting ini.</p><h3>Hasilnya</h3><p>Pertama kita lihat dulu pesaing kita memiliki konsep yang sama: <a href="http://ui-avatar.com/">ui-avatar.com</a><br> <br> Aplikasi ini memungkinkan kita untuk mengenerate avatar hanya melalui GET parameter. Bedanya adalah format file yang dihasilkan yakni PNG yang secara signifikan lebih besar dan kurang optimal untuk web.</p><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="https://ui-avatars.com/api/?name=John+Doe">https://ui-avatars.com/api/?name=John+Doe</a><br>Running 10s test @ <a href="https://ui-avatars.com/api/?name=John+Doe">https://ui-avatars.com/api/?name=John+Doe</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 295.75ms 6.97ms 349.48ms 87.76%<br> Req/Sec 21.02 11.78 50.00 79.61%<br> 1389 requests in 10.02s, 1.72MB read<br>Requests/sec: 138.64<br>Transfer/sec: 175.60KB</blockquote><p>Hasilnya adalah <strong>138 request per detik</strong> dengan latency sekitar <strong>7 milisecond per request.</strong></p><p>Lalu kita bandingkan dengan jagoan kita :</p><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="http://avatar-api.org/avatar.svg">http://avatar-api.org/avatar.svg</a> <br>Running 10s test @ <a href="http://avatar-api.org/avatar.svg">http://avatar-api.org/avatar.svg</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 1.78ms 661.53us 21.67ms 93.76%<br> Req/Sec 3.41k 185.27 3.93k 70.11%<br> 272862 requests in 10.10s, 106.95MB read<br>Requests/sec: 27016.57<br>Transfer/sec: 10.59MB</blockquote><p>Hasilnya adalah <strong>27 Ribu Request per detik!</strong> Setiap requestnya rata rata hanya perlu menunggu <strong>661 nano second!</strong> (1 nano second = 1000 micro second, 1000 micro second = 1 second). Hampir <strong>dua ratus kali lebih kuat</strong> dan <strong>sepuluh kali lebih cepat</strong> dari kompetitornya.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0mVBmiU84o5L-XQeZ4uNBA.png" /><figcaption>Hasil wrk testing</figcaption></figure><p>Sayangnya hasil dari analisa <em>builtwith</em> terhadap <a href="http://ui-avatar.io/">ui-avatar.io</a> tidak menunjukkan tekhnologi apa yang mereka gunakan dan sebesar apa server yang mereka gunakan. namun demikian bisa kita lihat kekuatan dari Erlang VM. <br> <br> Bagaimana dengan hasil test terhadap <a href="http://google.com/">Google.com</a>?</p><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="http://google.com/">http://google.com</a> <br>Running 10s test @ <a href="http://google.com/">http://google.com</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 6.96ms 13.84ms 246.56ms 94.49%<br> Req/Sec 1.43k 139.20 1.64k 73.12%<br> 114332 requests in 10.01s, 58.88MB read<br>Requests/sec: 11420.16<br>Transfer/sec: 5.88MB</blockquote><p>Hasilnya adalah <strong>11 ribu request per detik</strong>. Ini bukan pencarian. Hanya sekedar menampilkan halaman utama google yang berisi form pencarian. Tentu menampilkan itu juga bukan hal yang trivial bagi Google karena mereka perlu melakukan cek status user login dan sebagainya.<br> <br> Tadi pengan parameter pengujian yang sama, kita masih bisa berbangga saat mesin sekecil itu mampu melayani load sebesar itu.<br> <br> Secara teori, 27ribu RPS artinya kita mampu melayani sekitar <strong>2 Milyar request per hari!</strong></p><p>Okelah, untuk ukuran server seharga 5$ per bulan. Nah, dengan test parameter yang sama, sebagai perbandingan mari kita lihat performance dari beberapa website terkemuka di Indonesia:</p><h3>Detik.com = 3706 Request Per Second</h3><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="http://detik.com/">http://detik.com</a><br>Running 10s test @ <a href="http://detik.com/">http://detik.com</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 12.91ms 791.19us 25.19ms 84.86%<br> Req/Sec 465.55 18.22 500.00 76.50%<br> 37134 requests in 10.02s, 17.42MB read<br>Requests/sec: 3706.24<br>Transfer/sec: 1.74MB</blockquote><h3>Blibli.com = 3711 Request Per Second</h3><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="http://blibli.com/">http://blibli.com</a><br>Running 10s test @ <a href="http://blibli.com/">http://blibli.com</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 12.89ms 578.55us 37.32ms 92.82%<br> Req/Sec 466.55 15.54 494.00 81.50%<br> 37209 requests in 10.03s, 4.08MB read<br>Requests/sec: 3711.62<br>Transfer/sec: 416.83KB</blockquote><h3>Kaskus.co.id = 3770 Request per second</h3><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="http://kaskus.co.id/">http://kaskus.co.id</a><br>Running 10s test @ <a href="http://kaskus.co.id/">http://kaskus.co.id</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 12.70ms 570.32us 24.78ms 95.04%<br> Req/Sec 473.48 14.81 505.00 87.00%<br> 37758 requests in 10.01s, 12.24MB read<br>Requests/sec: 3770.32<br>Transfer/sec: 1.22MB</blockquote><h3>Traveloka.com = 12939 Request per second</h3><blockquote>root@locust-testing:/home/indodax# wrk -t8 -c50 -d10s <a href="http://traveloka.com/">http://traveloka.com</a><br>Running 10s test @ <a href="http://traveloka.com/">http://traveloka.com</a><br> 8 threads and 50 connections<br> Thread Stats Avg Stdev Max +/- Stdev<br> Latency 3.87ms 2.11ms 66.63ms 93.66%<br> Req/Sec 1.63k 198.91 2.02k 74.50%<br> 129575 requests in 10.01s, 35.22MB read<br>Requests/sec: 12939.70<br>Transfer/sec: 3.52MB</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d31c70360781" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to generate pretty color programmatically?]]></title>
            <link>https://medium.com/@virkill/how-to-generate-pretty-color-programmatically-117b34064b58?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/117b34064b58</guid>
            <category><![CDATA[colors]]></category>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Wed, 27 Feb 2019 00:38:45 GMT</pubDate>
            <atom:updated>2019-02-27T00:38:45.608Z</atom:updated>
            <content:encoded><![CDATA[<p>How to generate pretty color programmatically?</p><p>I’m supposed to do something else that other night and I drank too much coffee already. But then my ADHD kicks in and instead of focusing on my task I wonder how I can generate pretty random color programmatically? I know color wheel, but how it translated into Hex code?</p><p>Randomising RGB color and convert it to Hex code might be easy but it produces horrible color. Too random, to bright, too washed out, etc. How to make it consistently good? Bunch of Google and Wikipedia later, I read about HSV color instead of RGB, it HSV allows you to control the color only by manipulating Hue, and keep the saturation fixed. This gives a consistent color. Not too bright and not too dark. So this is how they can generate pretty pastel color consistently and almost seems like they have a predefined color scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*AHumzDGd1_urSDHhuQX4qg.png" /><figcaption>HSV color system</figcaption></figure><p>An hour later, I wrote a function to generate color in HSV format and convert to RGB, then to Hex. It worked, but I’m not satisfied with my Saturation default value.</p><p>Ok done, now what? Did this knowledge give any advantage for my job or project? Not really. The worst part is I know the library to do that already exist in ruby or Nodejs library somewhere. I realize I’m reinventing the wheel and it didn’t stop there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2O-9sO4G7AQdgDkpzTGdg.png" /><figcaption>Initial Based Avatar</figcaption></figure><p>Thinking about it, now I can use it to generate default avatar! You know, initial-based avatar popularised by Google. Let’s write a function to generate initials out of names. The problem is, of course, Indonesian can have a really long name. The existing algorithm simply uses regex and it works up to 3 words name. My approach, I decided to simply take the first and last word and take the first letter. On top of that let’s also find and ignore strange character. Done, what’s next?</p><p>Okay, how about the actual avatar generation part? The first option is to create png using an external library like ImageMagick. That’s how other people did it. But why they don’t use SVG? It produces less computing power, less dependency, less disk space, and can be generated and transported super fast. PNG can be around 3–4 Kb while I believe I can at least 25% less with SVG. <br> <br>With the spirit of DIY and reduce dependency, I write SVG generator by hand. It needs to ensure we can adjust the size programmatically, even though SVG is scalable by default once we made the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*TcxzalCKqA7Ze9DYan_Cgg.png" /><figcaption>The result</figcaption></figure><p>Okay, it’s done! Can I sleep now?</p><p>Not quite. I wonder how to generate unique color associated with the name? So it has a unique-ish property like Gravatar or Robohash? (Unlike actual hash, these will have pretty low collision probability but must be on good-enough level). This feature is to ensure the user has a somewhat consistent color associated with their name. The lazy approach is to generate the color randomly and store it in the database, but that’s boring. <br> <br> After giving some thought I started with hash the string, the straightforward md5 algorithm then try to figure out is how to map given string into 259 possible colors generated by the first function? I can’t figure out the satisfying approach. I fell asleep.<br> <br> The same problem still haunting me, the next morning at work. Two questions: how to map the hash string into 359 possible colors consistently? And how to find the right saturation setting for color generation algorithm. Thanks to Amanda Michiru who gives advice on the saturation setting. And Firdha Safri comes up with an elegant solution where we convert all the letter into a number, sum it up and use rem function to keep it below 359. Perfect! <br> <br> Now we have an SVG avatar generator, written in pure elixir. Let’s wrap it up, put it on GitHub, forget about it and continue my life and do something that actually matters! (Boy, I’m so wrong. I ended up spin up a whole service for this the next day. I’ll explain in the next article.)<br> <br> Here’s the GitHub project:</p><p><a href="https://github.com/virkillz/hash_color_avatar_elixir">https://github.com/virkillz/hash_color_avatar_elixir</a></p><p>And I publish it as hex.pm library for elixir.<br> <a href="https://hexdocs.pm/hash_color_avatar/0.1.0/HashColorAvatar.html">https://hexdocs.pm/hash_color_avatar/0.1.0/HashColorAvatar.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=117b34064b58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So I win a chatbot hackathon in Myanmar]]></title>
            <link>https://medium.com/@virkill/so-i-win-a-chatbot-hackathon-in-myanmar-12df3f915e41?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/12df3f915e41</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[myanmar]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Sun, 02 Apr 2017 02:50:55 GMT</pubDate>
            <atom:updated>2017-04-02T02:50:55.814Z</atom:updated>
            <content:encoded><![CDATA[<p>So I win a Chatbot hackathon last month in Yangon. Organized by GEN Myanmar, I win e-Commerce challenge and most favourite. Yesterday, my cousin back in Indonesia told me he want to make his own Chatbot, and my uncle ask me to give a few tips to him. I think it’s useful to put it here as well.</p><p><strong>Design</strong></p><p>There are several useful tips regarding how to design your chatbot.</p><p>1. Put one specific use case for your Chatbot, don’t be too generic.</p><p>Don’t aim your chatbot to be like siri, cortana, jarvis, or samantha (remember ‘hers’ the movie?). Before you start thinking to build chatbot, it’s a good thing to know the limitation of a chatbot. Unless you have some secret sauce technology, current chatbot cannot think like human. It boils down to ‘if else statement’, basically. So the best way is to think a spesific funtion and build a design around that particular function.</p><p>2. Create a persona for your chatbot.</p><p>Don’t treat chatbot like a CLI (command line interface) where you input some command and it return bare information you asked. Give it character, make it tease you or tell you occasional joke when you ask something, make it feels more like chat with a human being. But don’t get me wrong, don’t pretend to be human. Don’t lie to your user. Give a hint and disclosure upfront your users are talking to a bot. If you lie, soon or later people will find out its a bot and they will feel cheated. Give full disclosure it is a bot, and surprise them with more humanly interaction along the way.</p><p>3. Think, and rethink user experience.</p><p>When people open your bot for the first time, give them a hint about what they can do. Ask question first. This way you can guide the user trough your purpose within your bot limitation. If the platform you choose provide button or quick answer selection (such as facebook messenger, telegram, or slack), use it. Instead of user should type freely all the time, when it possible, provide them button. Try over and over again to understand every dead node across the conversation, fix it, optimize it.</p><p>4. Come to where users are.</p><p>Instead of make one website for your chatbot or build mobile apps so people can use your chatbot, when possible, use existing platform. Most of the time, it can be done with facebook messenger. It can play text, picture, video, audio (up to 20 mb) and display nice cards (up to 9 cards). You can then focus on how to attract Facebook user (which is almost everybody) to come using your page instead of open new website or download new apps.</p><p><strong>Regarding Technology</strong></p><p>1. Don’t reinvent the wheel.</p><p>Some of the people code the chatbot from ground up with the language they understand, simply because they not aware there already bunch of tools for it. If you prefer to have full control of your chatbot behavior and prefer to host the engine in your own server, there are ‘Program-o’ (for PHP), then you only need to program AIML for it. For general purpose chatbot especially if you use facebook messenger as your platform, chatfuel is more than enough. It have many feature such as easy integration with facebook messenger, drag and drop AI ‘programming’, easy connection with outside json API. The only drawback is : it doesn’t understand context. But most of the time, it get the jobs done and more.</p><p>2. Hack the hell out of your tool</p><p>Whatever tool you use, ensure you know much about its feature and how to extend it. Tool like chatfuel seems basic but when you know it inside out, it still amazed me what people can do with it.</p><p>3. Extend the tool you choose to create something new.</p><p>When you trust existing tool like chatfuel or program-o to handle the basic conversation flow, think about the external data source to make it interesting. Otherwise, chatbot with static data can be boring pretty quick. Ask the bot to tell joke, or ask the bot to tell what exchange rate for today (you get the idea), you can make it exciting and useful.</p><p><strong>Regarding Hackathon strategy</strong></p><p>1. Everything is boiled down to one minute presentation.</p><p>Most of the hackathon only provide you very limited amount of time to present your product. Don’t too focus with your product and spend the last hackathon day to prepare your presentation. Many good product in the hackathon fail to grab attention of the judge becaue their lack of prfesentation strategy. Practise to highlight the feature and the flow of your product (and why it is important to be exist) within the provided time (we got 4 minutes for this event).</p><p>2. Do your networking and collaboration.</p><p>Don’t forget this is not only a competition, use your time to talk to other people, other group, ask something, help someone, and share your product. If ready, ask them to use and get feedback. You might get ‘participant choice’ award because of that.</p><p>In the end, we can think chatbot as an interface to a software we built. Instead of provide them with static menu, we guide them with every function they choose in interactive way.</p><p>I hope this note can be useful for someone interested in AI, chatbot, or hackathon in general. Also for my cousin.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12df3f915e41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ketika Artificial Intelligence meramal masa depan Ahok]]></title>
            <link>https://medium.com/@virkill/ketika-artificial-intelligence-meramal-masa-depan-ahok-470a2692e29a?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/470a2692e29a</guid>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Wed, 14 Dec 2016 05:23:12 GMT</pubDate>
            <atom:updated>2016-12-14T05:23:12.607Z</atom:updated>
            <content:encoded><![CDATA[<p>Jika anda adalah salah satu orang yang percaya atas ramalan, saya memiliki satu ramalan untuk anda:</p><blockquote><em>“Anda akan merasa kecewa pada akhir artikel ini.”</em></blockquote><p>Oke oke, saya memang sedang mengekploitasi kepopuleran topik Ahok belakangan untuk menggiring perhatian pada beberapa topik lain yang sangat jauh berbeda. Artikel ini akan banyak membahas beberapa hal mulai dari ramalan, kecerdasan buatan, hingga pawang hujan.</p><p>Alkisah, pernah hidup disuatu masa, seorang penyair dan astrolog bernama Nostradamus. Dia yang hidup di abad ke 16, lebih tepatnya antara 1503 dan 1566, menulis banyak sekali quatrain dalam bahasa perancis yang ia bukukan per 100 quatrain yang dia beri judul centuries. Berikut satu quatrain yang dia buat:</p><blockquote><em>Bêtes farouches de faim fleuves tranner;<br>Plus part du champ encore Hister sera, <br>En caige de fer le grand sera treisner, <br>Quand rien enfant de Germain observa.</em></blockquote><blockquote><em>(Centuries II quatrain 24)</em></blockquote><p>Salah satu penggemarnya, Cheetam, menerjemahkannya kedalam bahasa inggris sebagai berikut:</p><blockquote><em>Beasts wild with hunger will cross the rivers, <br>The greater part of the battle will be against Hitler. <br>He will cause great men to be dragged in a cage of iron, <br>When the son of Germany obeys no law.</em></blockquote><p>Sejenak, coba pahami kalimat tersebut. Baca kalimatnya satu persatu. Pahami konteksnya, dan pahami letak keanehannya.</p><p>Quatrain itu terlihat menceritakan tentang hitler. Pertanyaanya: Bagaimana mungkin orang yang lahir di abad 16 mendeskripsikan kebangkitan hitler yang lahir lebih dari 300 tahun sesudahnya dengan sangat akurat? Mulai dari nama, negara, hingga deskripsi bagaimana rezimnya menyeret orang besar kedalam sangkar besi? Sejago itukah nostradamus dalam meramal?</p><p>Ini baru satu quatrain. Dia memiliki ratusan quatrain. Dan beberapa quatrain disebutkan meramalkan meledaknya pesawat ulang alik challanger, kematian john F. kenedy hingga tragedi WTC 9 November.</p><p><strong>Bagaimana mungkin?</strong></p><p>Walau sempat menjadi legenda umum selama bertahun tahun pada akhirnya Ini kemudian dijelaskan secara gamlang oleh James Randi. Dia adalah seorang mantan pesulap beraliran escapologis, tokoh skeptik yang mendirikan James Randi Educational Foundation. Lembaga ini terkenal karena menawarkan uang 1 juta dollar bagi siapapun yang mampu mendemonstrasikan kemampuan supranatural dalam kondisi yang diawasi ketat, dan tidak ada yang pernah berhasil membuktikannya hingga sayembara ditutup lebih dari 10 tahun kemudian. Randi menjelaskan bahwa kecocokan nostradamus dengan kejadian populer sangat tergantung pada kreativitas orang yang mencocokkannya. Dalam contoh kasus ramalan hitler, kesalahan terbesar sudah ada sejak penerjemahan dari bahasa perancis menjadi bahasa inggris. Dengan berbekal kemampuan menerjemahkan bahasa perancis kuno, pengetahuan budaya dan sejarah setempat, inilah terjemahan versi Randi:</p><blockquote><em>Beasts mad with hunger will swim across rivers, <br>Most of the army will be against the Lower Danube. <br>The great one shall be dragged in an iron cage <br>When the child brother will observe nothing.</em></blockquote><p>Randi menunjukkan bahwa kata ‘Hister’ tidak merujuk pada nama orang, melainkan nama lokasi geografis di sekitaran Danube. Begitu pula dengan kata “Germain” yang direferensikan pada area di Eropa jaman dulu, sebelah utara Danube dan sebelah timur Rhine dan bukan merujuk negara Jerman.</p><p>Kecocokan sajak lain dengan kejadian lain pun dijelaskan sebagian besar adalah cocoklogi (pencocokan paksa) yang melibatkan penerjemahan, pemutar balikan kata, pemaksaan tahun, bahkan sajak palsu yang tidak ditemukan di literatur Nostradamus yang asli.</p><p><strong>Trik dibalik ramalan</strong><br>Dari masa kemasa banyak tokoh peramal yang muncul ke permukaan. Ki Joko bodo dan mama lorentz di Indonesia adalah dua contoh dari Indonesia. Di kancah internasional paul the octopus misalnya terkenal karena memprediksi kemenangan permainan bola di Piala dunia.</p><p>Yang tidak banyak orang sadari adalah: diluar orang orang yang terkspose media ada jauh lebih banyak lagi orang yang mengaku bisa meramal dan sering mengeluarkan ramalan. Sebagian dari mereka jatuh tanpa sempat terkenal. Ada dua kesamaan mereka:<br>1. Ramalannya sering ambigu dan multi tafsir. Ini memungkinkan mereka atau pengikutnya berkilah jika gagal atau memaksakannya supaya cocok.<br>2. Pamornya redup begitu ramalannya mulai meleset.</p><p>Menariknya, pola ini mirip dengan fenomena keberadaan pawang hujan. Tentu saja hanya ada dua kemungkinan hasil dari pekerjaan pawang hujan, yaitu Hujan atau tidak hujan. Dengan prinsip probabilitas ditambah sedikit berbekal prediksi cuaca BMKG seorang pawang hujan bisa survive berkarir bertahun tahun hingga pamornya turun dan tidak dipercaya lagi. Dengan prinsip probabilitas, kalikan ribuan orang yang perprofesi sama, akan ada segelintir pawang hujan yang paling banyak sukses berturut turut. Jika anda tertarik bisa mempelajarinya dengan mencari ‘law of large number’. Tentu pawang hujan yang gagal tidak akan terkenal, hanya pawang hujan yang memiliki track record panjang lah yang terkenal. Informasi ini beredar dari mulut ke mulut sehingga di dalam persepsi masyarakat berkembang: Pawang hujan itu ada dan sakti. Ditambah lagi, pawang hujan sering menjustifikasi kegagalannya dengan “atau pihak lawan menyewa pawang hujan yang lebih sakti.” atau bahkan sekedar “kehendak Tuhan”. Dewasa ini memang orang terlalu mudah membawa nama Tuhan untuk menjustifikasi apapun perbuatannya. Dan orang lain tidak bisa protes.</p><p>Kembali ke topik, ada banyak sekali trik yang bisa digunakan untuk memunculkan efek seolah anda bisa meramal. Pernah membaca ramalan zodiak? Mereka menggunakan trik yang dikenal dengan “barnum statement” atau gaya penulisan tertentu yang menimbulkan efek dimana orang merasa tulisan tersebut sangat mendeskripsikan mereka. Penulisannya ditulis sedemikian rupa sehingga terkesan spesifik padahal sering berlaku secara umum seperti:</p><blockquote><em>“Ada sering merasa orang lain susah memahami anda. Dalam keadaan tertentu anda adalah pemimpin yang baik. “</em></blockquote><p>Kebanyakan orang merasa sesuai dengan deskripsi semacam itu. Ada sebuah percobaan terkenal yang dilakukan Bertram Forer (1914–2000) dimana dia mencatat nama dan tanggal lahir para siswanya dan memberikan selembar kertas yang dikatakan hasil analisa psikologi komputer atas pribadi mahasiswanya. Isinya sebagai berikut:</p><blockquote><em>You have a need for other people to like and admire you, and yet you tend to be critical of yourself. While you have some personality weaknesses you are generally able to compensate for them. You have considerable unused capacity that you have not turned to your advantage. Disciplined and self-controlled on the outside, you tend to be worrisome and insecure on the inside. At times you have serious doubts as to whether you have made the right decision or done the right thing. You prefer a certain amount of change and variety and become dissatisfied when hemmed in by restrictions and limitations. You also pride yourself as an independent thinker; and do not accept others’ statements without satisfactory proof. But you have found it unwise to be too frank in revealing yourself to others. At times you are extroverted, affable, and sociable, while at other times you are introverted, wary, and reserved. Some of your aspirations tend to be rather unrealistic.</em></blockquote><p>Forer lantas meminta siswanya untuk memberi nilai dari skala 0–5 sejauh mana analisa psikologi tersebut cocok dengan karakter mereka. Nilai 4 adalah “good” dan nilai 5 adalah “excelent”. Hasilnya? Nilai rata rata keseluruhan adalah 4.2 dalam artian 84% akurat. Mereka diberi tahu kemudian bahwa semua orang mendapat kertas dengan tulisan yang sama persis.</p><p>Trik diatas adalah segelintir trik yang bisa dimanfaatkan untuk menimbulkan efek ramalan. Seolah orang mengetahui sesuatu tentang kita. Kumpulan tekhnik semacam ini bisa diterapkan untuk “meramal” masa lalu dan masa depan, “membaca” pikiran, “menggali” memori, dan sebagainya. Jika tertarik anda bisa membacanya di sebuah buku berjudul “The Full Fact Book of Cold reading” Tulisan Ian Rowland.</p><p>Nah, kita sudah mengetahui polanya. Lalu bagaimana menuangkan dalam bentuk algoritma sehingga mesin bisa melakukan “ramalan” untuk kita?</p><p><strong>Artificial Inteligence</strong><br>Pandu (@mbakpandu) dari IBM Indonesia membuat robot twitter yang bisa membuat puisi. Tidak hanya itu, robot ini juga bisa meniru gaya puisi orang lain. Terinspirasi dari ciptaannya, saya memiliki ide serupa untuk membuat robot yang hidup di Twitter bernama Airima (@rima_robot) yang mempelajari gaya penulisan puisi Nostradamus dan membuatnya mampu menciptakan sajak dengan gaya yang sama dengan nostradamus, yaitu gaya ramalan. Setiap satu jam Airima mengenerate sebuah kalimat yang seolah keluar dari mulut cenayang dari abad ke 15. Kalimat yang penuh kata misterius yang ambigu di suatu tempat namun terkesan detail di tempat lain.</p><p>Ini dilakukan dengan sebuah algoritma bernama ‘rantai markov’. Belajar dari 3500 baris quatrain Nostradamus, Airima mengenerate kalimat dari pola yang dia pelajari literatur tersebut. Karena berbekal Nostradamus, banyak diantara kalimat yang dia hasilkan menyebut nama nama lokasi di Eropa. Pada akhirnya kita menemukan satu “ramalan” yang bisa kita eksploitasi bersama sehingga seolah sedang meramalkan Ahok.</p><p>Ini adalah ramalan dia yang akan kita cocok cocokkan dengan masa depan Ahok:</p><blockquote><em>“Quality of the sun. Under the splendor will be a King who will come to compromise the fork-nosed one.”<br>Airima, 12 December 2016</em></blockquote><p>Apa artinya? Mari kita cocologikan bersama.<br>Siapa yang dimaksud ‘quality of the sun’? Siapa lagi kalau bukan Ahok. Selain bahwa dia bagaikan matahari yang mencerahkan Jakarta (lebay? sengaja.), nama aslinya pun adalah “Basuki tjahaja Purnama”. Cahaya, dan purnama. Dia layaknya bulan dengan kualitas matahari, kualitas purnama. Lalu apa yang dimaksud kalimat selanjutnya? “The splendor” yang dimaksudkan disini, siapa lagi kalau bukan Jokowi. Yang pamornya tidak diragukan lagi sebagai bintang baru di jagad politik Indonesia. Dari sini kita bisa mengambil kesimpulan (ngawur) bahwa Ahok akan menjadi raja (presiden) dibawah restu Jokowi yang nantinya akan terpaksa berkompromi dengan “fork-nosed one.” Siapa itu “fork-nosed one”? Siapa lagi kalau bukan beberapa orang yang nurut saja dengan perintah untuk demo layaknya “kerbau dicucuk hidung” (fork-nosed) padahal sebagian besar tidak tau kejadian dan ucapan Ahok yang sebenernya yang dibilang menista agama itu.</p><p>Ngawur? Jelas. Berarti anda masih waras. Saya sendiri tidak secanggih itu dalam hal mencocok cocokkan. Masih ada yang lainnya. Hingga saat ini Airima masih membuat ramalan tiap satu jam sekali.</p><p>Ini adalah “proof of concept” dimana kita bisa mencocok cocokkan kalimat dengan model tersebut terhadap satu event yang akan terjadi atau telah terjadi.<br>Suatu hari nanti kita tinggal mencocok cocokkan kejadian besar yang terjadi dengan salah satu dari baris yang ia buat lalu membuat klaim bombastis bahwa:</p><p><strong>“KEJADIAN INI TELAH DIRAMALKAN ROBOT DENGAN KECERDASAN BUATAN JAUH HARI SEBELUMNYA”.</strong></p><p>Lalu tunjukkan analisa bagaimana baris tersebut cocok dengan kejadian yang ada. Lalu bagaimana dengan kalimat lain yang tidak masuk akal? Kita tinggal katakan: “Akal terbatas kita belum mampu menerjemahkannya.” Kita bisa dengan mudah bersikap militan terhadap Airima dengan berprinsip “Airima tidak pernah salah. Kesalahan adalah produk manusia yang memiliki akal terbatas dalam menafsirkannya.”.</p><p>Fenomena ini jelas terjadi pada Nostradamus. Beberapa orang sangat yakin bahwa Nostradamus memang memiliki kemampuan melihat dimasa depan. Tergantung kemampuan oranglah kata kata nostradamus bisa diterjemahkan. Ini juga terjadi pada kitab Jayabaya di tanah Jawa yang diperkirakan ditulis di abad yang sama dengan Nostradamus. Karena syairnya memiliki gaya penulisan prediktif di beberapa bagian, ada orang yang menganggap ia mampu memprediksi masa depan. Dikatakan hanya keterbatasan kitalah, kalimat itu tidak sepenuhnya dipahami. Pola ini terjadi di banyak literatur yang diagungkan. Setiap masa ada literatur yang dikultuskan dan dikatakan memprediksi sebuah kejadian di masa depan dengan arti kalimat yang dicocok cocokkan. Anda mungkin menyadari betapa saya menghindari mengatakan kitab suci memiliki pola yang sama. Itu penistaan.</p><p>Begitulah.</p><p>Bagaimana? Sudah kecewa?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=470a2692e29a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ketika robot dengan Artificial Inteligence beropini tentang Ahok]]></title>
            <link>https://medium.com/@virkill/ketika-robot-dengan-artificial-inteligence-beropini-tentang-ahok-379003199202?source=rss-d95d04a18afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/379003199202</guid>
            <dc:creator><![CDATA[VirKill]]></dc:creator>
            <pubDate>Wed, 14 Dec 2016 02:30:12 GMT</pubDate>
            <atom:updated>2016-12-14T02:30:12.439Z</atom:updated>
            <content:encoded><![CDATA[<p>Rileks, ini artikel bukan tentang politik. Ini membahas teknologi kecerdasan buatan, algoritma komputer, dan robot Twitter. Masih ingin lanjut?</p><p>Ok. Bayangkan skenario di mana kita bisa meminta program dengan kecerdasan buatan untuk memberikan opininya terhadap suatu topik. Dan dia bisa menjawabnya. Pasti seru. Seberapa ngaco opininya? Seberapa nyambung?</p><p>Tentu saja tekhnologi robot AI belum sampai pada tahap dia bisa berpikir dan mempertimbangkan suatu topik. Jika ada pun, mungkin masih dalam pengembangan yang digenggam erat oleh raksasa tekhnologi seperti google. Komputer dan software bagus dalam hal mengolah data, namun masih belum mampu memahami dan mempertimbangkan sebuah wacana. Lalu bagaimana kita bisa mencapai efek dimana robot memberikan opini? Kita menggunakan algoritma yang dinamakan rantai markov untuk mencapai efek itu.</p><p>Algoritma ini mampu menyusun ulang sebuah <em>sequence</em> dari data yang diberikan, berdasarkan pada probabilitas pola yang muncul. Dia merujuk pada data historis dan digunakan untuk memprediksi kata apa yang muncul setelah kata tertentu. Penerapannya cukup banyak dan cukup ajaib.</p><p>Keyboard smartphone Anda besar kemungkinan sudah memiliki fitur yang memanfaatkan algoritma ini. Dia memunculkan kata apa yang disarankan tiap Anda selesai mengetik satu kata berdasarkan histori Anda menggunakan keyboard, atau histori standar bawaan aplikasi.</p><p>Contoh lainnya, kita bisa membuat puisi dengan gaya yang sama hanya dengan memberikannya kumpulan puisi sebagai referensi. Robot Twitter saya, Airima (@rima_robot) mampu membuat baris-baris ramalan ala nostradamus secara cukup realistik setelah saya memberinya 3500 baris <em>quatrain</em> dari nostradamus. Dengan kata lain, Airima bisa membuat sajak nostradamus setelah belajar dari 3500 baris sajak nostradamus.</p><p>Ini bisa diterapkan pada Nietzsche, dia mampu membuat kalimat dengan gaya bahasa seperti Nietzsche walau jika diperhatikan seksama akan sering ditemukan kata yang nggak nyambung.</p><p>Tapi di situlah kecocokannya. Kata yang digenerate dari algoritma markov akan seolah sering cocok secara grammar, namun agak aneh secara makna sehingga ini akan cocok untuk men-<em>generate</em> hal-hal seperti puisi atau kalimat yang seolah memiliki makna mendalam (semacam <em>pseudo intelectual words</em>). Robot puisi (@robotpuisi) ciptaan Mbak Pandu dari IBM Indonesia adalah contoh penerapan model ini, Anda bisa beradu puisi dengannya.</p><p>Microsoft sempat membuat robot Twitter bernama Tay dengan algoritma kecerdasan buatan di baliknya. Idenya adalah menyerap opini di jagad Twitter dan akhirnya membentuk pengetahuan dan karakternya sebagai robot. Public Relation Microsoft mengatakan bahwa Tay diharapkan dapat beropini layaknya anak muda sehingga Microsoft dapat memahami aspirasi tipikal anak muda secara umum.</p><p>Banyak programer (termasuk saya) yang menerka-nerka algoritma seperti apa yang ada di baliknya. Tebakan saya adalah: Tay menggunakan preprogrammed AI behaviour dengan AIML untuk percakapan standar dan sementara itu mengumpulkan opini yang di-<em>mention </em>kepadanya dan pada akhirnya diolah dengan algoritma serupa markov chain.</p><p>Masalahnya adalah: <em>hacker</em> mana pun yang punya pasukan robot twitter, bisa men-<em>spam</em> Tay dan memaksakan sebuah opini. Karena inti dari rantai markov adalah analisa probabilitas, maka jelas ini adalah sebuah bug yang cukup fundamental. Hasilnya? Kurang dari 24 jam Tay berubah dari robot naif menjadi robot rasis, pemuja hitler, dan suicidal. Microsoft menutup proyek itu seketika.</p><p>Mereka yang kurang paham akan kemungkinan teknologi di balik Tay (saya bilang kemungkinan karena tentu saja hanya Microsoft yang tahu persis), menggunakan insiden ini sebagai argumen bahwa pengembangan kecerdasan buatan (AI) adalah suatu yang mengerikan dan dapat mengancam kelangsungan manusia.</p><p>Sementara saya melihat bahwa teknologi sekarang, termasuk teknologi yang digunakan oleh SIRI, Cortana, ataupun Google Assistant, fondasinya masih sebatas <em>pattern matching</em>, belum mendekati “kesadaran” yang mampu menyelesaikan <em>turing test</em> yang paling sederhana sekalipun. Kita belum sampai ke sana.</p><p>Para pemimpin perusahaan teknologi di seputaran Silicon Valley sedang merumuskan kode etik bagi AI. Di sisi lain, masih banyak pekerjaan yang harus dilakukan untuk mencapai sebuah kesadaran komputer. <em>Artificial inteligent</em> masih memerlukan kemajuan dari banyak disiplin ilmu sekaligus mulai dari <em>machine learning, Natural Language Processing, </em>hingga komponen pendukungnya seperti <em>speech recognition, neural network, big data analysis</em>.</p><p>Kembali ke topik yang menyenangkan. Bagaimana membuat efek yang serupa dengan Tay? Kemarin saya mencobanya. Saya memprogram Airima (@rima_robot) sehingga ketika kita tweet dan mention dia yang mengandung kalimat “apa opini kamu tentang”, maka dia akan mengolah kata atau kalimat sesudah itu dan membuat tweet tentang topik tersebut. Salah satunya adalah sebagai berikut:</p><p>“Apa opini kamu tentang persidangan Ahok?”</p><p>Salah satunya dia menjawab: “Terlalu banyak yang sudah dia lakukan untuk Islam. Kita tidak boleh membiarkannya jalan sendiri.”</p><p>Wow. Apakah dia benar berpikir demikian? Tidak.</p><p>Itu adalah salah satu jawaban terbaik dan nyambung dengan topik yang diberikan. Beberapa percobaan sebelum dan sesudahnya menghasilkan kalimat yang sulit dipahami walau seolah relevan.</p><p>Di baliknya, program akan mengubah kalimat tersebut menjadi string pencarian dan dengan menggunakan Twitter search API, mencari 100 tweet sehubungan kalimat atau tagline tersebut. Lalu difilterlah dan dikeluarkan tweet yang berupa retweet, tweet yang mengandung link (biasanya sekedar share link), tweet duplikat (biasanya ulah bot juga), dan menghapus semua kata yang diawali tanda @ (mention).</p><p>Ini dilakukan 20 kali (karena pencarian terbatas maksimal 100 search per hit) dan hasilnya dikumpulkan menjadi sebuah teks panjang berisi kumpulan opini tentang topik tersebut. Dari sinilah diterapkan algoritma markov untuk men-<em>generate</em> opini dari topik yang diminta.</p><p>Masih banyak ide menarik untuk mengembangkan metode ini meski masih berbasis algoritma markov. Salah satunya adalah dengan menyimpannya dalam database berbasis dokumen yang biasa digunakan untuk <em>support big data</em>, dan menyimpan node yang di-<em>generate</em> dari rantai markov ke dalam database juga. Hasilnya adalah <em>generate </em>kalimat yang lebih unik, menarik dan kemungkinan lebih relevan.</p><p>Namun pada akhirnya, proyek iseng ini hanya sebatas <em>prove of concept</em> (POC) saja karena masih mengandung banyak bug. Saya turunkan dari Twitter. Salah satu kendalanya adalah search API Twitter sangatlah terbatas. Jika kita meminta opini dengan string yang agak panjang, di atas 4 kata, Twitter tidak memberikan hasil, program akan <em>crash.</em></p><p>Di sisi lain, ada juga masalah sepele namun cukup menyebalkan, yaitu bagaimana memotong kalimat yang dihasilkan agar tidak lebih dari 140 karakter namun masih tetap berarti. Ah, sudahlah.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=379003199202" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>