<?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[Fadlur Notes - Medium]]></title>
        <description><![CDATA[Notes I made while learning programming. - Medium]]></description>
        <link>https://medium.com/fadlur?source=rss----fffd002ce6c0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Fadlur Notes - Medium</title>
            <link>https://medium.com/fadlur?source=rss----fffd002ce6c0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:15:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/fadlur" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Latihan membuat model klasifikasi]]></title>
            <link>https://medium.com/fadlur/latihan-membuat-model-klasifikasi-35254c8cac2e?source=rss----fffd002ce6c0---4</link>
            <guid isPermaLink="false">https://medium.com/p/35254c8cac2e</guid>
            <category><![CDATA[happy-coding]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Fadlur Rohman]]></dc:creator>
            <pubDate>Tue, 03 Jun 2025 16:35:37 GMT</pubDate>
            <atom:updated>2025-06-03T16:35:01.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_njup-1-KHFet0EOCR-IkQ.jpeg" /><figcaption>machine learning</figcaption></figure><p>Salah satu wishlist tahun 2025 ini adalah lanjut kuliah lagi, yang mana akhirnya terwujud dengan melanjutkan kuliah S2 di Universitas Diponegoro.</p><p>Masih di Teknik Elektro.</p><p>Salah mata kuliah yang aku dapat adalah algoritma dan komputasi cerdas. Minggu ini kita dikasih tugas membuat model klasifikasi. Bebas mau pake model apa, dan yang aku pilih:</p><ul><li>Random Forest</li><li>KNN</li><li>Logistic Regression</li></ul><p>Untuk kodenya seperti ini:</p><pre># -*- coding: utf-8 -*-<br>&quot;&quot;&quot;Tugas_Algoritma_Fadlur_Rohman.ipynb<br><br>Automatically generated by Colab.<br><br>Original file is located at<br>    https://colab.research.google.com/drive/184w6KD3hLaT1HnoT5fO2FHKwNyUGDsO1<br><br># FADLUR ROHMAN (21060124420015)<br>## Klasifikasi Obat Berdasarkan Dataset Drug200<br>## Tujuan: Membuat model klasifikasi menggunakan tiga algoritma:<br>- Random Forest<br>- K-Nearest Neighbors<br>- Logistic Regression)<br>&quot;&quot;&quot;<br><br># Mengimpor library yang diperlukan<br>import pandas as pd<br>from sklearn.model_selection import train_test_split<br>from sklearn.ensemble import RandomForestClassifier<br>from sklearn.neighbors import KNeighborsClassifier<br>from sklearn.linear_model import LogisticRegression<br>from sklearn.preprocessing import LabelEncoder<br>from sklearn.metrics import accuracy_score<br><br># Memuat dataset<br>data = pd.read_csv(&#39;drug200.csv&#39;)<br><br># Menampilkan beberapa baris pertama dataset untuk memeriksa<br>data.head()<br><br># prompt: tampilkan jumlah baris data<br><br>print(&quot;Jumlah baris data:&quot;, data.shape[0])<br><br># Mengkodekan variabel kategorikal menjadi numerik<br>le_sex = LabelEncoder()<br>le_bp = LabelEncoder()<br>le_cholesterol = LabelEncoder()<br>le_drug = LabelEncoder()<br><br>data[&#39;Sex&#39;] = le_sex.fit_transform(data[&#39;Sex&#39;])  # Mengkodekan kolom Jenis Kelamin<br>data[&#39;BP&#39;] = le_bp.fit_transform(data[&#39;BP&#39;])  # Mengkodekan kolom Tekanan Darah<br>data[&#39;Cholesterol&#39;] = le_cholesterol.fit_transform(data[&#39;Cholesterol&#39;])  # Mengkodekan kolom Kolesterol<br>data[&#39;Drug&#39;] = le_drug.fit_transform(data[&#39;Drug&#39;])  # Mengkodekan kolom Obat<br><br># Memisahkan fitur dan target<br>X = data[[&#39;Age&#39;, &#39;Sex&#39;, &#39;BP&#39;, &#39;Cholesterol&#39;, &#39;Na_to_K&#39;]]  # Fitur<br>y = data[&#39;Drug&#39;]  # Target<br><br># Membagi data menjadi set pelatihan (80%) dan pengujian (20%)<br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<br><br># Inisialisasi model<br>rf_model = RandomForestClassifier(random_state=42)  # Model Random Forest<br>knn_model = KNeighborsClassifier()  # Model K-Nearest Neighbors<br>lr_model = LogisticRegression(max_iter=5000, random_state=42)  # Model Logistic Regression<br><br># Melatih model<br>rf_model.fit(X_train, y_train)  # Melatih Random Forest<br>knn_model.fit(X_train, y_train)  # Melatih KNN<br>lr_model.fit(X_train, y_train)  # Melatih Logistic Regression<br><br># Membuat prediksi<br>rf_pred = rf_model.predict(X_test)  # Prediksi dengan Random Forest<br>knn_pred = knn_model.predict(X_test)  # Prediksi dengan KNN<br>lr_pred = lr_model.predict(X_test)  # Prediksi dengan Logistic Regression<br><br># Menghitung akurasi<br>rf_accuracy = accuracy_score(y_test, rf_pred)  # Akurasi Random Forest<br>knn_accuracy = accuracy_score(y_test, knn_pred)  # Akurasi KNN<br>lr_accuracy = accuracy_score(y_test, lr_pred)  # Akurasi Logistic Regression<br><br># Menampilkan akurasi<br>print(&quot;Akurasi Random Forest:&quot;, rf_accuracy)<br>print(&quot;Akurasi K-Nearest Neighbors:&quot;, knn_accuracy)<br>print(&quot;Akurasi Logistic Regression:&quot;, lr_accuracy)</pre><p>Setelah dijalankan hasil akurasinya seperti berikut:</p><pre>Akurasi Random Forest: 1.0<br>Akurasi K-Nearest Neighbors: 0.7<br>Akurasi Logistic Regression: 0.9</pre><p>Mudah bukan??? wkwkwk</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35254c8cac2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fadlur/latihan-membuat-model-klasifikasi-35254c8cac2e">Latihan membuat model klasifikasi</a> was originally published in <a href="https://medium.com/fadlur">Fadlur Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solution Different of Squares use C]]></title>
            <link>https://medium.com/fadlur/solution-different-of-squares-use-c-123ac9c07f06?source=rss----fffd002ce6c0---4</link>
            <guid isPermaLink="false">https://medium.com/p/123ac9c07f06</guid>
            <category><![CDATA[electronic-engineering]]></category>
            <category><![CDATA[c-language]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Fadlur Rohman]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 08:38:13 GMT</pubDate>
            <atom:updated>2024-08-24T08:37:57.536Z</atom:updated>
            <content:encoded><![CDATA[<p>Early this month I checked my <a href="https://exercism.org/">exercism</a> account and found that my learning journey was stuck 6 months ago.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XysMMvNJ0N1kUlGDb3_2jw.jpeg" /></figure><p>Yes, I checked my C journey 2 days ago. I committed to starting my journey in learning C language since I studied electronic engineering on campus.</p><p>I have been starting with <a href="https://exercism.org/tracks/c/exercises/difference-of-squares">“Different of Squares”</a>. After googling and asking to ChatGPT. Here is a simple explanation of “Different of Squares”.</p><p>The “difference of squares” refers to a specific algebraic identity that describes the difference between two squared numbers. The formula for the difference of squares is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*C1oFJxZSOPjBk07ScK0d2Q.png" /><figcaption>Different of Squares Formula</figcaption></figure><p>Here is how it works:</p><p><em>a²</em> is the square of some number <em>a.<br>b²</em> = the square of some number b<em>.<br></em>The difference of squares formula shows that the difference between these two squares can be factored into the product of two binomials: <em>(a+b)</em> and <em>(a−b)</em>.</p><p>Now, we are back to <a href="https://exercism.org/tracks/c/exercises/difference-of-squares/edit">Exercism exercise</a>.</p><blockquote><strong>The instruction:</strong></blockquote><p>Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.</p><p>The square of the sum of the first ten natural numbers is (1 + 2 + … + 10)² = 5⁵² = 3025.</p><p>The sum of the squares of the first ten natural numbers is ¹² + ²² + … + 1⁰² = 385.</p><p>Hence the difference between the square of the sum of the first ten natural numbers and the sum of the squares of the first ten natural numbers is 3025–385 = 2640.</p><p>You are not expected to discover an efficient solution to this yourself from first principles; research is allowed, indeed, encouraged. Finding the best algorithm for the problem is a key skill in software engineering.</p><blockquote><strong>My Solution</strong></blockquote><pre>#include &quot;difference_of_squares.h&quot;<br>unsigned int sum_of_squares(unsigned int number) {<br>    unsigned result = 0;<br>    for (unsigned int i = 0; i &lt;= number; i++) {<br>        result += i * i;<br>    }<br>    return result;<br>}<br>unsigned int square_of_sum(unsigned int number) {<br>    unsigned result = 0;<br>    for (unsigned int i = 0; i &lt;= number; i++) {<br>        result += i;<br>    }<br>    return result * result;<br>}<br>unsigned int difference_of_squares(unsigned int number) {<br>    return square_of_sum(number) - sum_of_squares(number);<br>}</pre><p>It&#39;s probably not the best practice solution. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=123ac9c07f06" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fadlur/solution-different-of-squares-use-c-123ac9c07f06">Solution Different of Squares use C</a> was originally published in <a href="https://medium.com/fadlur">Fadlur Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Elixir in Exercism]]></title>
            <link>https://medium.com/fadlur/learning-elixir-in-exercism-5af2fbd690c9?source=rss----fffd002ce6c0---4</link>
            <guid isPermaLink="false">https://medium.com/p/5af2fbd690c9</guid>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[elixirlang]]></category>
            <dc:creator><![CDATA[Fadlur Rohman]]></dc:creator>
            <pubDate>Wed, 21 Aug 2024 10:23:04 GMT</pubDate>
            <atom:updated>2023-08-14T17:09:32.684Z</atom:updated>
            <content:encoded><![CDATA[<p>A few weeks ago, a recruiter asked me to send a cv. She said, her company needs a backend developer with specific requirements. Unfortunately, my skill didn’t match their requirement.</p><p>So, I think I need to upgrade my skill to the latest tech stack. After browsing the internet, I choose <a href="https://elixir-lang.org/">Elixir</a> as my new programming language.</p><blockquote>Elixir is a dynamic, functional language for building scalable and maintainable applications. Elixir runs on the Erlang VM, known for creating low-latency, distributed, and fault-tolerant systems.</blockquote><p>After finishing some sessions in “<a href="https://elixir-lang.org/getting-started/introduction.html">The Getting Started</a>”, I need something more practical.</p><h3>Exercism</h3><blockquote><strong>Exercism is</strong> an online, open-source, free coding platform that offers code practice and mentorship on 66 different programming languages.</blockquote><p>I started from here <a href="https://exercism.org/tracks/elixir">https://exercism.org/tracks/elixir</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o5c8IdLGX_InnQNpYsgCMQ.png" /><figcaption>Progress by the today</figcaption></figure><p>This is just one little step.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5af2fbd690c9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fadlur/learning-elixir-in-exercism-5af2fbd690c9">Learning Elixir in Exercism</a> was originally published in <a href="https://medium.com/fadlur">Fadlur Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authentication di laravel 8 menggunakan sanctum]]></title>
            <link>https://medium.com/fadlur/authentication-di-laravel-8-menggunakan-sanctum-e2effefce3f9?source=rss----fffd002ce6c0---4</link>
            <guid isPermaLink="false">https://medium.com/p/e2effefce3f9</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[laravel-sanctum]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Fadlur Rohman]]></dc:creator>
            <pubDate>Wed, 21 Aug 2024 10:22:25 GMT</pubDate>
            <atom:updated>2021-01-26T03:37:24.039Z</atom:updated>
            <content:encoded><![CDATA[<p>Laravel 8 menyediakan sistem authentication untuk SPA (single page application) semacam aplikasi berbasis vuejs atau reactjs, dan juga untuk aplikasi mobile. Sanctum memungkinkan masing-masing user mengenerate beberapa token untuk masing-masing akunnya. Jadi gini, semisal tadinya udah login di aplikasi berbasis web (SPA) terus login lagi di aplikasi berbasis android. User yang login tersebut akan mempunyai 2 token yang berbeda.</p><p>Di bagian belakang nanti akan kita bahas pada proses logout-nya. Dimana user bisa logout untuk 1 device atau untuk semua devicenya.</p><p>Sekarang kita buat dulu projectnya dengan menjalankan perintah di console atau terminal. Pastikan sudah terinstall composer dan php minimal versi 7.3.* untuk laravel 8.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FlnxvCYDDzzs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlnxvCYDDzzs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FlnxvCYDDzzs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1e0474dfa1b9f0ca0061dc1758b6cf6/href">https://medium.com/media/c1e0474dfa1b9f0ca0061dc1758b6cf6/href</a></iframe><p>Sekarang buka terminal dan jalankan perintah untuk membuat project dengan nama demo sanctum menggunakan composer.</p><pre>composer create-project --prefer-dist laravel/laravel demosanctum</pre><p>Tunggu sampai proses selesai. Masih di dalam terminal, jalankan perintah untuk menginstall laravel/sanctum.</p><pre>cd demosanctum<br>composer require laravel/sanctum</pre><p>Oh ya, siapkan dulu database di mysql. Pada demo ini database saya beri nama blog_sanctum.</p><p>Setelah proses instalasi laravel/sanctum selesai, kita lanjut ke step berikutnya. Yaitu publish configuration.</p><pre>php artisan vendor:publish --provider=&quot;Laravel\Sanctum\SanctumServiceProvider&quot;</pre><p>Kemudian buka folder demosanctum menggunakan editor, kemudian edit file .env pada bagian ini untuk menghubungkan ke database.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f5dfa97adff446c76598b75bacda0c0/href">https://medium.com/media/3f5dfa97adff446c76598b75bacda0c0/href</a></iframe><p>Sekarang kita bisa migrate migrations user dan lainnya.</p><pre>php artisan migrate</pre><p>Karena bawaan dari file migrations, field primary key menggunakan bigincrements akan ubah menjadi increments saja. Kita mulai dari migrations users sekalian menambahkan field status.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d160b42b4225a5bc3618e70c048c791b/href">https://medium.com/media/d160b42b4225a5bc3618e70c048c791b/href</a></iframe><p>Kemudian lanjut migrations personal_access_token</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04b974a7bf705eca10dbad945582eb97/href">https://medium.com/media/04b974a7bf705eca10dbad945582eb97/href</a></iframe><p>Jangan lupa untuk sesuaikan juga file app/Http/Kernel.php pada bagian “api” menjadi seperti berikut.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e09193f455cd0838b291af591e99899/href">https://medium.com/media/8e09193f455cd0838b291af591e99899/href</a></iframe><p>Kemudian file model app/Models/User.php kita sesuaikan agar bisa createToken</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ca3e5e1b7d300a320e38f4d7b94b18b/href">https://medium.com/media/9ca3e5e1b7d300a320e38f4d7b94b18b/href</a></iframe><p>Sekarang kita jalankan migrate:refresh untuk mengenerate ulang table dari migrations.</p><pre>php artisan migrate:refresh</pre><p>Agar kita bisa mencoba proses authentication, kita perlu memasukkan data users terlebih dahulu. Sekarang kita buat file UserSeeder.php.</p><pre>php artisan make:seeder UserSeeder</pre><p>Isi file UserSeeder.php kita ubah agar bisa menginput data users.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/24fc5e26f34fa2efb47f01ea152a6148/href">https://medium.com/media/24fc5e26f34fa2efb47f01ea152a6148/href</a></iframe><p>Dan juga file DatabaseSeeder.php agar bisa memanggil UserSeeder.php tadi.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7bf54debaa3e1d3e9287fa91a258fc05/href">https://medium.com/media/7bf54debaa3e1d3e9287fa91a258fc05/href</a></iframe><p>Kembali ke terminal dan jalankan seeder yang telah kita buat.</p><pre>php artisan db:seed</pre><p>Table dan settingnya sudah kita buat, selanjutnya kita buat controller AuthController.php</p><pre>php artisan make:controller AuthController.php</pre><p>Buka file AuthController.php dan ubah menjadi seperti berikut.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ae858b01aa01d6c4cda19fce038f0e9/href">https://medium.com/media/2ae858b01aa01d6c4cda19fce038f0e9/href</a></iframe><p>Kita perlu set route api-nya agar bisa diakses, buka file routes/api.php</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b662c454493aa8b236cd61460eec4d6/href">https://medium.com/media/5b662c454493aa8b236cd61460eec4d6/href</a></iframe><p>Karena pada versi laravel 8, cara memanggil agar berbeda dengan versi sebelumnya. maka biar bisa dipanggil kayak versi sebelumnya kita perlu mengedit namespace di route api di dalam file RouteServiceProvider.php</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e945988eb469a5c7c9dc4f6b5717344/href">https://medium.com/media/1e945988eb469a5c7c9dc4f6b5717344/href</a></iframe><p>Sampai sini sudah selesai, sekarang kita coba menggunakan postman.</p><ol><li>Login</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVcTApSKEFqJQwZR7ZKSaA.png" /><figcaption>Percobaan proses login</figcaption></figure><p>2. Logout</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7YUfoNLYvwlgr9TplbBukg.png" /><figcaption>Logout untuk token tersebut (yang dimasukkan ke headers)</figcaption></figure><p>3. Logout All</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1F4qYkjVPq7JTTp4PalmA.png" /><figcaption>Logout untuk semua token, jadi setelah berhasil semua token dihapus</figcaption></figure><p>Hasil jadinya bisa dicoba di github saya.</p><p><a href="https://github.com/fadlur/demosanctum">fadlur/demosanctum</a></p><p>Tulisan ini juga saya publish di web pribadi saya.</p><p><a href="https://fadlur.com/blog/rest-api-authentication-laravel-8-menggunakan-sanctum">Rest Api Authentication Laravel 8 menggunakan sanctum | Fadlur Rohman</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2effefce3f9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fadlur/authentication-di-laravel-8-menggunakan-sanctum-e2effefce3f9">Authentication di laravel 8 menggunakan sanctum</a> was originally published in <a href="https://medium.com/fadlur">Fadlur Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>