<?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 Ammarptn on Medium]]></title>
        <description><![CDATA[Stories by Ammarptn on Medium]]></description>
        <link>https://medium.com/@ammarptn?source=rss-817b8a5615a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lpnCI-8zXhtzJOlgbGfhHg.png</url>
            <title>Stories by Ammarptn on Medium</title>
            <link>https://medium.com/@ammarptn?source=rss-817b8a5615a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:24:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ammarptn/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[AccountFastTrack: How I Solved My Developer Login Fatigue with a Custom Android Keyboard]]></title>
            <link>https://medium.com/@ammarptn/accountfasttrack-how-i-solved-my-developer-login-fatigue-with-a-custom-android-keyboard-251c51e33e9a?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/251c51e33e9a</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[productivity-tools]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[problem-solving]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 16:01:59 GMT</pubDate>
            <atom:updated>2025-02-24T17:51:56.914Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPMQOw1zwbjn2fbv7scrNw.png" /></figure><p>Have you ever felt that tiny frustration when you’re deep in development mode, testing your app, and suddenly you need to type in login credentials… again? That was my daily reality as an Android developer. Every time I needed to test different user permissions or features, I had to type in usernames and passwords over and over.</p><h4><strong>The Daily Frustration</strong></h4><p>It might sound trivial, but here’s what kept happening:</p><p>I’m working on the Android emulator, fully focused on implementing a new feature. Everything’s flowing smoothly until… I need to test how it works for different user types. That means logging in and out. Again. And again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/0*FbGlrdACcwnOuVMP" /></figure><p>Each login attempt takes around 10 seconds — typing the username, typing the password. It doesn’t sound like much, but when you’re in the zone, those 10 seconds feel like an eternity. And the worst part? It completely breaks your focus.</p><h4><strong>Breaking the Flow</strong></h4><p>You know that feeling when you’re completely immersed in coding? When solutions just flow and you’re making great progress? That’s exactly what gets disrupted every time I need to:</p><p>- Type in test credentials</p><p>- Switch to another account to verify a feature</p><p>- Log back in after testing edge cases</p><p>- Check how it works with different user permissions</p><p>Each time I have to stop, type credentials, and try to get back into that flow state. It’s like someone tapping your shoulder every few minutes when you’re trying to concentrate.</p><h4><strong>Why Existing Solutions Weren’t Enough</strong></h4><p>Sure, I could use a password manager. But let’s be honest — even copying and pasting feels clunky when you’re doing it multiple times an hour. I wanted something seamless, something that wouldn’t force me to switch context or break my concentration.</p><p>I didn’t want to:</p><p>- Open another app</p><p>- Search for credentials</p><p>- Copy and paste repeatedly</p><p>- Switch between windows</p><p>I just wanted to stay focused on what matters — developing and testing the actual features.</p><h4><strong>The Solution: AccountFastTrack</strong></h4><p>Instead of accepting this daily friction, I decided to create AccountFastTrack — a specialized Android keyboard that lets developers instantly fill login credentials with a single tap. The concept is simple yet effective: when you need to log in, switch to the AccountFastTrack keyboard, select your account, and let the keyboard do the typing for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEN2pc7gUbYsmKFMthaAgw.gif" /></figure><h4><strong>How It Works</strong></h4><p>The app works in three simple steps:</p><p>1. <strong>Using the Keyboard</strong></p><p>- When you need to log in, tap the keyboard switcher (just like when you switch to emoji keyboard)</p><p>- Select “AccountFastTrack” keyboard</p><p>- Swipe between your saved accounts</p><p>- Tap to auto-fill username or password</p><p><strong>2. Security &amp; Privacy</strong></p><p>- Everything stays on your device</p><p>- No internet connection needed</p><p>- No external servers involved</p><p>- Perfect for development and testing</p><p><strong>The Tech Behind It</strong></p><p>For the technically curious, here’s what makes it tick:</p><p>- Built as a custom Android keyboard (like how you can install different keyboard apps)</p><p>- Uses Android’s official keyboard API (the same one used by Gboard or SwiftKey)</p><p>- Stores accounts securely on your device</p><p>- Works on Android 5.0 and newer devices</p><p>- Built with modern Android development tools</p><p>Think of it like having a personal assistant who remembers all your test accounts and can type them instantly whenever you need them — but it’s all packaged as a keyboard!</p><h4><strong>Why a Keyboard?</strong></h4><p>You might wonder, “Why build a keyboard when password managers exist?” The answer lies in workflow optimization. When I’m focused on developing or testing a feature, any context switch to external tools breaks my concentration. A keyboard is already part of the input workflow — there’s no need to switch apps, search for credentials, or copy-paste. Just tap and continue working.</p><h4><strong>The Impact</strong></h4><p>The results have been significant:</p><p>- Eliminated the ~10-second credential typing time per login</p><p>- Maintained development flow state</p><p>- Increased daily productivity</p><p>- Simplified testing across multiple user permissions</p><p>But beyond the time savings, the biggest win has been maintaining focus during development sessions. No more mental context switches to find and input credentials — just seamless authentication that feels natural to the development workflow.</p><h4><strong>Learning Outcomes</strong></h4><p>Building AccountFastTrack has been an enlightening journey. I’ve gained valuable insights into:</p><p>- Android’s Input Method Framework intricacies</p><p>- Balancing security with convenience</p><p>- UI/UX design for keyboard interfaces</p><p>- The importance of solving real-world problems</p><h4><strong>Future Possibilities</strong></h4><p>While AccountFastTrack perfectly serves my current needs, the project has opened up interesting possibilities:</p><p>- Integration with biometric authentication</p><p>- Custom keyboard layouts for different testing scenarios</p><p>- Potential for other developer-focused keyboard tools</p><p>- Template-based text expansion for testing</p><h4><strong>The Bigger Picture</strong></h4><p>This project embodies an important lesson in software development: sometimes the best solutions come from solving our own pain points. While AccountFastTrack might not be the ideal solution for end users (given security considerations), it perfectly solved my development workflow challenge.</p><p>The beauty of being a developer is that we have the power to create tools that make our lives easier. Even if we’re “reinventing the wheel” or creating something that might seem over-engineered to others, the learning experience and the perfect fit for our specific needs make it worthwhile.</p><h4><strong>Try It Yourself</strong></h4><p>I’ve made AccountFastTrack open source, and you can find it on GitHub:</p><p><a href="https://github.com/ammarptn/AccountFastTrack">https://github.com/ammarptn/AccountFastTrack</a></p><p>Feel free to explore, use, or contribute to the project. If you’re facing similar challenges in your development workflow, this might be the solution you’re looking for. And even if it’s not a perfect fit for your needs, I hope it inspires you to create tools that solve your own development pain points.</p><p>Remember: The best innovations often come from scratching your own itch. Don’t be afraid to build tools that make your development life easier, even if solutions already exist. The learning experience and perfect fit for your workflow make it worthwhile.</p><p>— -</p><p><em>*Have you created any developer tools to solve your own pain points? I’d love to hear about your experiences and solutions!*</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=251c51e33e9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Google Drive REST API on Android App]]></title>
            <link>https://medium.com/ammarptn/integrate-google-drive-rest-api-on-android-app-bc4ddbd90820?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc4ddbd90820</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[drive]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Tue, 18 Dec 2018 04:13:03 GMT</pubDate>
            <atom:updated>2021-05-17T04:33:48.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wjp2nvdplkT1HQZLvyF3BQ.png" /></figure><h4>Google Drive API for Android is deprecated</h4><p>Google just announced that they already depreciated the Google Drive API for Android. If your apps use this APIs you may get the email about this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkyCtGpcnh68HirKgeWU6A.png" /><figcaption><a href="https://developers.google.com/drive/android/deprecation">https://developers.google.com/drive/android/deprecation</a></figcaption></figure><p>However, the suggestion from them is moving to the G drive Rest API instead.</p><p><a href="https://developers.google.com/drive/api/v3/about-sdk">Introduction to Google Drive API | Google Developers</a></p><h4>Moving to Google Drive Rest API</h4><p>In the Rest API documents, you will found examples in JAVA but it seems not quite straightforward to integrate with Android.</p><p>The first thing is the authorization process.</p><p>Previously on Android, you can request the login dialog attached with G Drive permission and then you can start to access file and folder in the G Drive.</p><p>The example of Java Rest API requires a CREDENTIALS FILE in order to access Drive API. I found my self a little bit lost when I try to implement this but luckily Google had provided a document about Authorizing and using Rest APIs with Android.</p><p><a href="https://developers.google.com/android/guides/http-auth">Authorizing and Using REST APIs | Google APIs for Android | Google Developers</a></p><p>Everything looks easier now.</p><p>Google also provides an example of Android project about how to use Google drive Rest APIs at the link below.</p><p><a href="https://github.com/gsuitedevs/android-samples/blob/master/drive/deprecation/app/src/main/java/com/google/android/gms/drive/sample/driveapimigration/DriveServiceHelper.java">gsuitedevs/android-samples</a></p><p>Now migration from old Google drive APIs for Android to Google drive Rest API should be easy for you.</p><p>I also summarized step by step in case you still stuck in some process.</p><h4>Google Drive Rest Integration step by step</h4><h4>Step 1:</h4><p>Enable Google drive API in API console right here: <a href="https://console.developers.google.com/projectselector/apis/dashboard">https://console.developers.google.com/projectselector/apis/dashboard</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CdfhsdlFxwO8MGl7LSDkGg.png" /></figure><h4>Step 2:</h4><p>Authorize your android app. Add OAuth client ID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RxnIdau1enC1F-jCzXyzuA.png" /></figure><p>This step will allow you to use a login dialog in your android app. If you are migrating from old APIs. This should not be the problem.</p><p><strong>Step 2.1</strong> (Special Thank you <a href="https://medium.com/u/126b44dabf5">MG Developer</a> for point out this additional step, original post is here : <a href="https://medium.com/@m.godse/its-a-great-article-and-helped-very-well-301d52cba692">https://medium.com/@m.godse/its-a-great-article-and-helped-very-well-301d52cba692</a>)</p><p>2.1.1 On Google API Credential Console Click “Create OAuth client ID”</p><p>2.1.2. Select Application type as “Android”</p><p>2.1.3. Give it a friendly “Name” for the client ID, ideally APPNAME-USER-DEBUG or APPNAME-PROJECT-PROD.</p><p>2.1.4. Enter the package name, you can locate package name for your Android APP in the AndroidManifest.xml under your project.</p><p>2.1.5. SHA1 fingerprint: Here little explanation is required. Each Android app (apk) is signed using keystore. Yes even your debug apks have keystore that you may not even know. You will need to locate your default keystore on your computer.</p><p>You can also have a common keystore file for your project, if you have multiple developers. However in that case your IDE or if you are building APK headless you will need to specify the keystore location and the password.</p><p>Otherwise default “debug.keystore is located in the user/username/.android folder”. You would need keytool to read the fingerprint. Keytool is a JDK utility shipped with Android studio, locate it in your Android Studio installation “Android\Android Studio\jre\bin”</p><p>Then execute `keytool -keystore user\username\.android\debug.keystore -list -v`</p><p>Password for the default Android debug.keystore is, yes you guessed it right. It is “android”, without the quotes. This will print the keystore details which will include SHA1 fingerprint.</p><p>6. Copy and the SHA1 finger print in the SHA1 textbox.</p><p>7. Save and now you should see Google Signin Screen and GoogleSignIn.getLastSignedInAccount(context) should return the account handle.</p><p>(Thank you <a href="https://medium.com/u/126b44dabf5">MG Developer</a> again for this part)</p><h4>Step 3:</h4><p>add OAuth consent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GmSUS9km_e_hxM0sxxQ7OA.png" /><figcaption>open OAuth consent screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*by6HwJ4OpyPSq2m9nwFMzA.png" /><figcaption>Add scope</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3sLTuyUx-P0OoRxdL0sLQ.png" /><figcaption>Select “../auth/drive”, lock icon mean you have to submit for verification.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*foF25YZDhnenyRCtNnETYg.png" /></figure><p>Bear in mind that you required to submit for verification before your application goes live.</p><p>Without verification, you still can access google drive but it will only appear folder and file that your app created.</p><p>Don’t be surprised when you try to search some existed folder or file but it not return you anything.</p><h4>Step 4:</h4><p>Now you can start to put some code on Android</p><p>Start by add dependencies on Gradle.build</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79b5c0940ce5a7f8361e82c5277e0faf/href">https://medium.com/media/79b5c0940ce5a7f8361e82c5277e0faf/href</a></iframe><h4>Step 5:</h4><p>Google’s example already provided a JAVA helper file <a href="https://github.com/gsuitedevs/android-samples/blob/master/drive/deprecation/app/src/main/java/com/google/android/gms/drive/sample/driveapimigration/DriveServiceHelper.java">here</a>. Copy and paste in your project. Trust in their magic and save your time.</p><p><a href="https://github.com/gsuitedevs/android-samples/blob/master/drive/deprecation/app/src/main/java/com/google/android/gms/drive/sample/driveapimigration/DriveServiceHelper.java">gsuitedevs/android-samples</a></p><h4>Step 6:</h4><p>Start Google sign in and then create a credential and provide that instance to DriveServiceHelpper</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6c2b472888ccdae9d99e9de526fffea/href">https://medium.com/media/f6c2b472888ccdae9d99e9de526fffea/href</a></iframe><p>For full example : <a href="https://github.com/ammarptn/GDrive-Rest-Android/blob/master/app/src/main/java/com/ammarptn/gdriverest/MainActivity.java">https://github.com/ammarptn/GDrive-Rest-Android/blob/master/app/src/main/java/com/ammarptn/gdriverest/MainActivity.java</a></p><h4>Step 7:</h4><p>Everything is ready. you can start to access your file on G Drive.</p><p>In order to handle the response data easier, I create a holder object to keep the result.</p><p>For example :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8aaf6a0f910323e82130bfb599f3a494/href">https://medium.com/media/8aaf6a0f910323e82130bfb599f3a494/href</a></iframe><p>Next is edit the <strong>mDriveServiceHelper </strong>file by adding these code below.</p><h4>G drive Mime Type</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fb3f345d9907dca3fc1cd6db300034b/href">https://medium.com/media/8fb3f345d9907dca3fc1cd6db300034b/href</a></iframe><h4>Search file</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/07d68dec5c771a900b77481b1061374e/href">https://medium.com/media/07d68dec5c771a900b77481b1061374e/href</a></iframe><p>you can view more info about how to write a query and return fields at</p><p><a href="https://developers.google.com/drive/api/v3/search-parameters">Search for Files and Team Drives | Drive REST API | Google Developers</a></p><h4>Search folder</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd8c2c724f7a780062152a9529608a75/href">https://medium.com/media/cd8c2c724f7a780062152a9529608a75/href</a></iframe><h4>View files in folder</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/486eebc1e138d96435be925142e626fd/href">https://medium.com/media/486eebc1e138d96435be925142e626fd/href</a></iframe><h4>Create a text file</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e6a01b429b9489a9bd4fc2e0c88bc29/href">https://medium.com/media/9e6a01b429b9489a9bd4fc2e0c88bc29/href</a></iframe><h4>Create folder</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f28a8eb651b6e0ed4adc7cf837a552a/href">https://medium.com/media/2f28a8eb651b6e0ed4adc7cf837a552a/href</a></iframe><h4>Upload file</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c7e526309bb79c99d74386bf1f3df71/href">https://medium.com/media/6c7e526309bb79c99d74386bf1f3df71/href</a></iframe><h4>Download file</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3630639f6c37469e5bf9b3f586b2e8a/href">https://medium.com/media/e3630639f6c37469e5bf9b3f586b2e8a/href</a></iframe><h4>Delete file/folder</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/baeeafeed715301bc7794c8e20a382d3/href">https://medium.com/media/baeeafeed715301bc7794c8e20a382d3/href</a></iframe><h4><strong>How to manage my file then?</strong></h4><p>If you did not submit for verification yet. Your app will limit to files that its created. It may hard for you to do some testing like try to upload, read a file from the Gdrive. (your app will not able to see any file that you upload at Google drive’s Web interface/app. you have to code an upload function and execute from your app)</p><p>To make our developers&#39; life easier, I created a small file explorer library that will help you manage your files and allow your app to access any file that you want.</p><p>To use this library, just put this into your app gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12b424f63c3740489c7b964810fe9d57/href">https://medium.com/media/12b424f63c3740489c7b964810fe9d57/href</a></iframe><p>And open Google drive explorer by open this Activity class</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7343eb31fce21bf2798d2f30daa3297e/href">https://medium.com/media/7343eb31fce21bf2798d2f30daa3297e/href</a></iframe><p>This will allow you to upload any file from your phone, view and delete it. So you can test your app more efficient and spend less time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWWic25Fz7Uqgdj48-6dCA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2I1rjsz3-1PXbusDPsQu8Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sNDXeAnW6mg0MjO2xiT-Mg.jpeg" /></figure><h4>Remark</h4><ul><li>File instance for Google drive is not the same as File that you use on local storage.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55ff60c7a66cb100fe1159c18d77b3df/href">https://medium.com/media/55ff60c7a66cb100fe1159c18d77b3df/href</a></iframe><ul><li>When you create a folder or file on google drive, it will not replace the existing one. It is not the same behavior as java.io.file that you can replace it when writing the file with an existing name. Otherwise, you may found that your app consumes all of the user’s G drive.</li><li>My current solution for replacing is searching for file/folder ID and delete it before performing a file upload.</li><li>App data folder will remove from G drive soon. So change your mind if you have the plan to use it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qud2-pWeCTpwBUiZ7c6L_g.png" /><figcaption><a href="https://developers.google.com/drive/android/deprecation">https://developers.google.com/drive/android/deprecation</a></figcaption></figure><p>Any suggestion or improvement, let me know in the comment below.</p><p>ref.</p><ul><li><a href="https://developers.google.com/drive/android/deprecation">Google Drive Android API Deprecation | Drive API for Android (Deprecated) | Google Developers</a></li><li><a href="https://developers.google.com/drive/api/v3/about-sdk">Introduction to Google Drive API | Google Developers</a></li><li><a href="https://github.com/gsuitedevs/android-samples">gsuitedevs/android-samples</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc4ddbd90820" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/integrate-google-drive-rest-api-on-android-app-bc4ddbd90820">Integrate Google Drive REST API on Android App</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ปิด/เปิด Crashlytic เมื่อรันใน Debug Mode แบบอัตโนมัติด้วย Gradle]]></title>
            <link>https://medium.com/ammarptn/%E0%B8%9B%E0%B8%B4%E0%B8%94-%E0%B9%80%E0%B8%9B%E0%B8%B4%E0%B8%94-crashlytic-%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%A3%E0%B8%B1%E0%B8%99%E0%B9%83%E0%B8%99-debug-mode-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%AD%E0%B8%B1%E0%B8%95%E0%B9%82%E0%B8%99%E0%B8%A1%E0%B8%B1%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-gradle-c97d6207ef69?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c97d6207ef69</guid>
            <category><![CDATA[disable]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ปิด]]></category>
            <category><![CDATA[crashlytics]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Sat, 15 Sep 2018 16:23:11 GMT</pubDate>
            <atom:updated>2018-12-05T02:16:39.938Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tu4n3x-kKDWE6dOQ5Y7H7A.png" /></figure><p>ในการพัฒนา Android แอพ — Crashlytic เป็นเครื่องมือที่ช่วยในการจัดการและแจ้งเตือนเวลาแอพของเราเกิดปัญหา Force close</p><p>โดยปกติเมื่อทำการติดตั้ง Crashlytic เข้ากับแอพแล้ว เมื่อมีการ crash เกิดขึ้น Firebases จะแจ้งเตือนทางอีเมล์ทันที โดยคนในทีมก็จะได้รับ อีเมล์นี้เช่นกัน</p><p>ทำให้เวลาทดสอบหรือพัฒนาฟีเจอร์ใหม่ๆแล้วเกิด crash ของตัวแอพ Crashlytic ก็จะยังแจ้งเตือน สร้างความผวาและปั่นป่วนในทีมอยู่ไม่น้อย</p><p>เพื่อป้องกันไม่ให้เกิดความเข้าใจผิดในกรณีแอพ crash ระหว่างการพัฒนาแอพ และตัว Production บทความนี้จึงจะมาแนะนำการจัดการการแจ้งเตือนนี้กัน</p><p>โดย Document ของ Crashlytic ได้บอกวิธีการปิดการแจ้งเตือน โดยสามารถเข้าไปดูได้ที่ link ข้างล่าง</p><p><a href="https://firebase.google.com/docs/crashlytics/customize-crash-reports#enable_opt_in_reporting">https://firebase.google.com/docs/crashlytics/customize-crash-reports#enable_opt_in_reporting</a></p><p>หลังจากที่เราได้ติดตั้ง Crashlytic เข้ากับโปรเจกของเราแล้ว ทันทีแอพมีปัญหา เราก็จะได้รับอีเมล์จาก Firebase โดย ทีม Firebase ได้เขียนไว้ว่า เราสามารถปิดมันได้ทั้งแบบ Runtime และ Build Process โดยบทความนี้จะเน้นในส่วนของ Build Process เพื่อลดบรรทัดของโค้ดที่เราต้องไปเขียน ในไฟล์ Java/Kotlin</p><p>หลังจากที่เราได้ติดตั้ง Crashlytic เข้ากับโปรเจกของเราแล้ว ทันทีแอพมีปัญหา เราก็จะได้รับอีเมล์จาก Firebase โดย ทีม Firebase ได้เขียนไว้ว่า เราสามารถปิดมันได้ทั้งแบบ Runtime และ Build Process โดยบทความนี้จะเน้นในส่วนของ Build Process เพื่อลดบรรทัดของโค้ดที่เราต้องไปเขียน ในไฟล์ Java/Kotlin</p><p>ในการแก้ เราก็แค่เพิ่ม</p><pre>&lt;meta-data android:name=”firebase_crashlytics_collection_enabled” android:value=”false” /&gt;</pre><p>ใน Tag ของ &lt;applicaiton&gt; เพียงเท่านี้ Crashlytic ก็จะไม่แจ้งเตือน crash อีกต่อไป</p><p>แต่ทำให้เกิดภาระ เวลาเราจะ build Production/Release เราก็ต้องมาแก้เป็น true เวลา Debug ก็ต้องแก้เป็น false</p><p>การแก้ไปแก้มาเองแบบ manual นี้ อาจจะทำให้เราเผลอลืมแก้ให้เป็นค่าที่ถูกต้องในกรณีที่ต้องเปิดมัน เช่น เผลอปิดไปขณะกำลัง Build ตัว Production ทำให้ crash ที่เกิดขึ้นในการใช้งานจริงก็จะไม่มีการแจ้งเตือน</p><p>เพื่อไม่ให้เกิดความผิดพลาดและยุ่งยาก เราสามารถใช้ Gradle ในการควบคุมได้และไม่ต้องมาแก้เองอีกต่อไป เพราะว่า จาก link นี้</p><p><a href="https://developer.android.com/studio/build/manifest-build-variables">Inject build variables into the manifest | Android Developers</a></p><p>ได้บอกไว้ว่าเราสามารถ inject ค่าจาก Gradle ลงไปได้ ตัวอย่างเช่นกำหนดใน Gradle</p><pre>android {<br>    defaultConfig {<br>        manifestPlaceholders = [hostName:&quot;www.example.com&quot;]<br>    }<br>    ...<br>}</pre><p>แล้วก็ inject ลง AnroidManifact.xml</p><pre>&lt;intent-filter ... &gt;<br>    &lt;data android:scheme=&quot;http&quot; android:host=&quot;${hostName}&quot; ... /&gt;<br>    ...<br>&lt;/intent-filter&gt;</pre><p>นั้นหมายความว่าเราสามารถ inject ค่า True หรือ False เพื่อเปิดและปิดแบบอัตโนมัติ</p><p>จาก Doc ด้านบน เราก็เปลี่ยนจาก falseเป็น ${triggerCrashlytic} ตามโค้ดด้านล่าง</p><pre>&lt;meta-data android:name=”firebase_crashlytics_collection_enabled” android:value=”${triggerCrashlytic}” /&gt;</pre><p>แล้วเราก็ไปเพิ่ม field triggerCrashlytic ที่ไฟล์ build.gradle ในส่วนของ app module โดยกำหนดในเมื่อ Build แบบ Debug ให้ส่งค่า triggerCrashlytics เป็น false และหากเป็น Release ให้ส่งค่าเป็น True</p><pre>android {<br>    ...<br>    buildTypes {<br>        release {<br>            ...<br>            manifestPlaceholders = [triggerCrashlytic: true]<br><br>        }<br>        debug {<br>            manifestPlaceholders = [triggerCrashlytic: false]<br>        }<br>    }<br>}</pre><p>เมื่อแก้เสร็จแล้ว ก็ sync หากไม่มั่นใจก็สามารถทดลองทำให้มัน Crash ดูก็ได้</p><p>โดยถ้าเราสั่งรันแอพที่เป็น Debug build เมื่อเกิดการ crash มันก็จะไม่แจ้งเตือนใดๆ</p><p>หากเรารันแอพที่เป็น Release build เมื่อมี crash เราก็ได้รับการแจ้งเตือนแน่นอน</p><p>ขอให้สนุกกับการ Crash ครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c97d6207ef69" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/%E0%B8%9B%E0%B8%B4%E0%B8%94-%E0%B9%80%E0%B8%9B%E0%B8%B4%E0%B8%94-crashlytic-%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%A3%E0%B8%B1%E0%B8%99%E0%B9%83%E0%B8%99-debug-mode-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%AD%E0%B8%B1%E0%B8%95%E0%B9%82%E0%B8%99%E0%B8%A1%E0%B8%B1%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-gradle-c97d6207ef69">ปิด/เปิด Crashlytic เมื่อรันใน Debug Mode แบบอัตโนมัติด้วย Gradle</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[APP:”แชร์เลขพัสดุ” แอพที่พ่อค้า/แม่ค้าควรโหลดไว้]]></title>
            <link>https://medium.com/ammarptn/%E0%B9%80%E0%B8%8A%E0%B9%89%E0%B8%B2%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%AB%E0%B8%99%E0%B8%B6%E0%B9%88%E0%B8%87-%E0%B8%9C%E0%B8%A1%E0%B9%84%E0%B8%9B%E0%B8%AA%E0%B9%88%E0%B8%87%E0%B8%82%E0%B8%AD%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%84%E0%B8%9B%E0%B8%A3%E0%B8%A9%E0%B8%93%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%95%E0%B8%B2%E0%B8%A1%E0%B8%9B%E0%B8%81%E0%B8%95%E0%B8%B4-%E0%B9%80%E0%B8%88%E0%B9%89%E0%B8%B2%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%81%E0%B9%87%E0%B8%A2%E0%B8%B7%E0%B8%99%E0%B9%83%E0%B8%9A%E0%B9%80%E0%B8%AA%E0%B8%A3%E0%B9%87%E0%B8%88%E0%B8%A1%E0%B8%B2%E0%B9%83%E0%B8%AB%E0%B9%89-695d52f82a2b?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/695d52f82a2b</guid>
            <category><![CDATA[thai]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[tracking]]></category>
            <category><![CDATA[me]]></category>
            <category><![CDATA[scanner]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Sat, 26 May 2018 15:45:46 GMT</pubDate>
            <atom:updated>2018-05-26T15:50:53.255Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0AxzNQ5cPIeT_6MFVJ8Vw.png" /></figure><p>ก่อนจะไปแนะนำแอพ ถ้าอยากรู้ความเป็นมา ลองอ่านดูเพลินๆก่อนก็ได้</p><h4>จุดเริ่มต้นมันมีอยู่ว่า</h4><p>เช้าวันหนึ่ง ผมไปส่งของที่ไปรษณีย์ตามปกติ เจ้าหน้าที่ก็ยืนใบเสร็จมาให้ ในนั้นจะมีเลขรหัสพัสดุของที่เราเพิ่งส่งไป</p><p>การบอกให้คนรับของรู้ว่าเราส่งของแล้วนะ ผมถือว่าเป็นความรับผิดชอบอย่างนึงที่คนส่งของให้ควรจะทำ ผมเลยไม่ลืมที่จะส่งเลขพัสดุไปหาคนที่รอรับของ ให้เค้าสามารถเอาไป track ได้ อย่างน้อยก็สร้างความอุ่นใจให้กับคนรับ</p><p>ก่อนออกจากไปรษณีย์ ผมก็หยิบมือถือเปิดโปรแกรมแชต แล้วกรอกเลขพัสดุ ให้กับคนรับพัสดุที่ปลายทาง</p><p>ผมชอบที่จะกรอกรหัสพัสดุลงในช่องแชตแล้วส่งไป มากกว่าถ่ายรูปส่งไปให้</p><p>เพราะเวลาผมเป็นลูกค้าที่รอรับของ ผมก็อยากได้เลขรหัส ที่มัน สามารถกดก้อปปี้เอาไปใส่ในเว็ป track ของไปรษณีย์ได้ทันที ไม่ใช่รูปภาพที่ ต้องมานั่งกดเองอีกรอบ มันเสียเวลา แม้จะเพียงน้อยนิดก็ตาม แถมถ้าจะเช็คซ้ำในวันอื่นก็ต้อง ทำแบบเดิมอีกรอบ</p><p>ในช่วงที่ออร์เดอร์น้อยๆ พิมพ์ส่งเองมันก็ไหวอยู่ แต่พอมันเริ่มเยอะขึ้น สิบออร์เดอร์ก็สิบรอบเริ่มเหนื่อย แต่ก็ต้องทำ เพราะเค้าซื้อของเราแล้ว เราก็ต้องดูแลบริการให้สุดความสามารถใช่ป่าวว ลูกค้าจะได้ซื้อของเราอีกนานๆ</p><h4>สรุปง่ายๆ</h4><blockquote>ผมขี้เกียจพิมพ์เลขพัสดุให้คนรับเวลาส่งของ แต่จำเป็นต้องทำอะ ถ่ายรูปก็ดูจะมักง่ายไป</blockquote><p>รหัสพัสดุหนึ่งชุด มี สิบตัวอักษร</p><ul><li>ใช้เวลาในการพิมพ์ เฉลี่ยแล้วจำนวนสิบวินาที</li><li>หากต้องกดแบบ ดูใบเสร็จทีละสองตัวแล้วมากด เวลาเฉลี่ยก็จะเพิ่มเป็น สิบสี่วินาที</li><li>นี่ยังไม่นับเวลาในการเปิดแอพแชต อีกนะ</li></ul><p>กดๆมองๆพิมพ์ ก็มีโอกาศที่คนเราจะกดผิดได้เสมอ นั้นก็จะทำให้เสียเวลาในการ ทวนหรือเช็คอีกรอบ โดยรวมแล้ว เดาเอาคราวๆว่า หนึ่งรายการ ใช้เวลาสามสิบวิ</p><ul><li>10 ออร์เดอร์ ก็เสียไป 5นาที</li><li>ถ้าเกิน 50 ออร์เดอร์หล่ะ ผมว่าเกิน 30 นาทีชัวร์</li></ul><blockquote>การแปลงข้อมูลบนใบเสร็จธรรมดาเป็นข้อมูล digital แบบมนุษย์ๆนี้มันเสียเวลาเหลือเกิ้น</blockquote><p>แต่ว่าในทุกๆความขี้เกียจมักจะมีไอเดียเสมอ ผมมองเลขรหัสพัสดุในใบเสร็จ แล้วคิดว่าจะทำอย่างไร ที่จะแปลงข้อมูลบนกระดาษที่พร้อมจะยับและเหี่ยวได้ทุกเวลา ให้อยู่ในรูปแบบ digital ด้วยความเร็วมากกว่าการกดพิมพ์เอง</p><p>ผมเสียเวลาในการคิดประมาณ ห้านาทีครึ่ง แล้วรีบกลับบ้าน เพื่อทำสิ่งที่ตัวเองถนัดที่สุด นั้นคือ “เขียน App มือถือ”</p><p>ผ่านไปสามสิบนาที ผมสร้าง Prototype ตัวแรกเสร็จ</p><h4>ถือเป็นจุดเริ่มต้นของ Project นี้</h4><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqJ1g3OxWzEQ&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqJ1g3OxWzEQ%3Ffeature%3Doembed&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e9cb94a40f9ae640187e80545809935/href">https://medium.com/media/4e9cb94a40f9ae640187e80545809935/href</a></iframe><h4>แอพนี้ทำอะไรได้บ้าง</h4><p>จุดประสงค์หลักๆของแอพนี้คือการลดขั้นตอนและเวลา โดยเราตั้งเป้าหมายว่า หลังจากส่งของแล้ว ชั้นตอนในการแจ้งเลขต้องลดลง ไม่เสียเวลา ได้ใจลูกค้า ต้องไม่ผิดพลาด ต้องทำให้ลูกค้าหรือคนรับของเช็คเลขพัสดุได้สะดวกขึ้นกว่าเดิม</p><h4>มาดูกันว่ามันทำอะไรได้บ้าง</h4><p>เปิดแอพขึ้นมา แอพก็จะแสดง Timeline ว่าเราสแกนอะไรไปบ้าง หรือถ้าไม่เคยสแกนอะไร แอพก็จะแสดงปุ่ม ให้เราเริ่มสแกนได้ทันที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JN2R1e-gbnzGBx7Zz0Yu9A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WpO-8-RflmwEy3nIExolXw.jpeg" /><figcaption>หน้าแรกของ แอพ</figcaption></figure><h4>สแกนและบันทึก</h4><p>เมื่อเรากดปุ่ม สแกน แอพก็จะเรียกกล้อง เราก็แค่ไปกดถ่ายรูปเลขรหัสพัสดุที่อยู่บนใบเสร็จ ถ้าบนใบเสร็จมีรหัสอยู่ มันดึงเอารหัสมาแล้วก็แสดงหน้าต่างยืนยันให้เราบันทึก หากจะใส่บันทึกเพิ่มเติมก็สามารถทำได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PwdVDmTxjcOthULG7YImQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLhUcOYvukV062xWcPy6zA.jpeg" /><figcaption>สแกนแล้วก็บันทึก</figcaption></figure><h4>เช็คและแชร์</h4><p>เมื่อบันทึกเสร็จแล้ว รหัสพัสดุก็จะไปอยู่ในรายการ Timeline หากเรากด ปุ่มเช็คสถานะ แอพก็จะพาไปหน้า Track ของไปรษณีย์ไทย สามารถเช็คได้ทันทีว่าพัสดุถึงที่หมายหรือยัง</p><p>และหากเราจะแจ้งเลขรหัสพัสดุ ก็แค่กดแจ้งเลข แล้วแอพก็จะแสดงรายการแอพแชตเราก็แค่เลือกแอพแชตที่เราต้องการแชร์ต่อ ซึ่งสามารถส่งได้ทั้ง Line หรือ Messenger</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JN2R1e-gbnzGBx7Zz0Yu9A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VSNi1N-uh-txE2d8Xxhh-g.jpeg" /></figure><h4>แก้ไขข้อความที่จะส่งได้</h4><p>ในเมนูตั้งค่าเราจะพบกับ เมนูสำหรับการกำหนดรูปแบบข้อความในการแจ้ง ว่าเมื่อกดแชร์แล้วจะแสดงรูปแบบข้อความแบบไหน ถ้าหากเราต้องการเปลี่ยน ก็สามารถแก้ไขได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUosT0gxhpGKdbTytRBQVA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQ2nsVpquOicoteQeuRRZw.jpeg" /></figure><p>ลูกค้าที่รับข้อความก็จะได้รับข้อความตามรูปแบบข้อความที่เราตั้งไว้ พร้อมลิ้งค์สำหรับไว้กดไปยังหน้า Tracking</p><p>ไม่มีอะไรยาก และทำให้การจัดเก็บรหัสพัดสุนั้นเป็นระบบมากขึ้น ประหยัดเวลาไปได้อีกเยอะ</p><h4>สุดยอดใช่ไหมหล่ะ</h4><p>ถ้าหากสนใจ สามารถดาว์นโหลดไปใช้ได้ฟรีๆเลยที่</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*dWurra8HaLeJbScQcv1BTA.png" /></figure><h3><a href="https://play.google.com/store/apps/details?id=com.ammarptn.emscodescanner">https://play.google.com/store/apps/details?id=com.ammarptn.emscodescanner</a></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=695d52f82a2b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/%E0%B9%80%E0%B8%8A%E0%B9%89%E0%B8%B2%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%AB%E0%B8%99%E0%B8%B6%E0%B9%88%E0%B8%87-%E0%B8%9C%E0%B8%A1%E0%B9%84%E0%B8%9B%E0%B8%AA%E0%B9%88%E0%B8%87%E0%B8%82%E0%B8%AD%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%84%E0%B8%9B%E0%B8%A3%E0%B8%A9%E0%B8%93%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%95%E0%B8%B2%E0%B8%A1%E0%B8%9B%E0%B8%81%E0%B8%95%E0%B8%B4-%E0%B9%80%E0%B8%88%E0%B9%89%E0%B8%B2%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%81%E0%B9%87%E0%B8%A2%E0%B8%B7%E0%B8%99%E0%B9%83%E0%B8%9A%E0%B9%80%E0%B8%AA%E0%B8%A3%E0%B9%87%E0%B8%88%E0%B8%A1%E0%B8%B2%E0%B9%83%E0%B8%AB%E0%B9%89-695d52f82a2b">APP:”แชร์เลขพัสดุ” แอพที่พ่อค้า/แม่ค้าควรโหลดไว้</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Gallery Architecture กับ Willow watch face]]></title>
            <link>https://medium.com/ammarptn/image-gallery-architecture-%E0%B8%81%E0%B8%B1%E0%B8%9A-willow-watch-face-d50fee73b2a2?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d50fee73b2a2</guid>
            <category><![CDATA[gallery]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[watches]]></category>
            <category><![CDATA[willow]]></category>
            <category><![CDATA[face]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Sat, 26 May 2018 13:13:15 GMT</pubDate>
            <atom:updated>2018-05-26T13:23:15.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3YlraxBL5t9lZ3Aznm4AuQ.png" /></figure><p>หนึ่งในโปรเจคส่วนตัวที่ผมทำอยู่คือ Willow watch face สามารถเข้าไปอ่านเพิ่มเติมได้ที่ <a href="https://ammar.lanui.online/project-story-willow-watch-face-1-f7122b3b243e">Project Story: Willow watch face #1</a></p><p>ตอนนี้ก็จะต่อจากตอนที่แล้ว ที่ค้างไว้คือเรื่องของ Online Gallery (กว่าจะได้เขียน ตอนนี้ก็ เปลี่ยน Architecture ไปอีกแบบละ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hoRvZGBW1AXHWdL6No7aHw.png" /></figure><p>ฟีเจอร์หลักที่สำคัญมากอย่างหนึ่งของ Willow watch face ก็คือ Online Gallery นี้แหละ ที่ช่วยให้ User เข้าถึงภาพสวยๆ เอาไปใช้ตั้งเป็นพื้นหลังหน้าปัดนาฬิกาได้ ซึ่งนับว่าเป็น killing feature ที่ทำให้ Willow watch face สร้างความแตกต่างจากแอพหน้าปัดอื่นๆได้อย่างชัดเจน</p><p>แต่ว่าการสร้าง online gallery นั้นไม่ง่าย เพราะมีปัจจัยทั้งในด้านเทคนิค ด้านลิขสิทธ์ ด้านค่าใช้จ่าย ที่ต้องคิดอีกเยอะ</p><p>อย่างแรก รูปภาพทุกภาพมีลิขสิทธิ์ ทำให้เราไม่สามารถไปกว้านเอาภาพจากเน็ตมากองๆให้คนไปโหลดได้ ภาพบางภาพก็มีมูลค่า จะใช้งานก็ต้องซื้อ และเมื่อมีเงินเข้ามาเกี่ยวข้อง ยิ่งทำให้ต้องคิดให้เยอะ</p><p>แต่วิธีจัดการก็ไม่ได้ยากเสมอไป เพราะในโลกนี้ยังมี ภาพที่มีลิขสิทธิ์ แต่มีสัญญาอนุญาติให้เข้าถึงหรือเอาไปใช้ได้ฟรี หนึ่งในนั้นคือ <a href="https://stocksnap.io/">https://stocksnap.io/</a></p><h4>ภาพฟรีจาก StockSnap.io</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yZjc0_fdTTc7DzNRkN-5g.png" /></figure><p>ซึ่ง สัญญาอนุญาติเนี่ย มันให้เราเอาภาพไปทำอะไรก็ได้ เอาไปแจกจ่ายที่ไหนก็ได้ โดยไม่ต้องขอ!!</p><p>ซึ่งเข้าทางเราที่สุด นับว่าตอนนี้เราได้คลังภาพมาแล้ว หมดกังวลเรื่องลิขสิทธิ์ด้วย</p><p>ขั้นต่อไปคือ การนำไปใช้ในแอพของเรา ทำยังไงจะให้ user ของเราสามารถเข้าถึงภาพเหล่านี้</p><h4>Model ตัวแรก สำหรับ Online gallery</h4><p>Architecture ตัวแรกคือ การตั้ง Server เก็บรูปภาพเอง ทำ API เอง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*_PQTBqDIbZuJaXRoFS1KqQ.png" /><figcaption>Architecture ที่ออกแบบไว้ตอนแรก</figcaption></figure><p>ซึ่งมันก็ดูง่ายแต่มันไม่ง่ายอย่างที่คิดแน่นอน</p><p>ตั้ง Server เองเนี่ย ก็ต้องมีการดูแล แถมการอัพโหลดภาพเนี่ยใช้พื้นที่เยอะด้วย ภาพ 100 ภาพขนาดเต็มๆ ก็อย่างน้อย 300 MB นี้ยังไม่นับแบนด์วิทที่มีจำกัดอีก User เจ้ามารุมโหลดแปปเดียวก็เต็มแล้ว แถมมีค่าใช้จ่ายเพิ่มแน่นอน</p><p>แต่ก็ใช้แบบนี้อยู่ในช่วงแรกๆที่เปิดตัวแอพ แต่ว่าไม่ได้มี Web portal ไว้จัดการภาพหรอกนะ เพราะว่า ไม่มีเวลา และอาจจะขี้เกียจ เลยไม่ได้ทำไว้ เลยทำให้ ในความเป็นจริงแล้วมันออกมาเป็นแบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*tzrsslN_rvqtdwfcjDMN5g.png" /><figcaption>Flow ของจริงเป็นงี้</figcaption></figure><p>เข้าไปใส่เพิ่มในดาต้าเบสตรงๆเลย</p><ul><li>ขั้นแรก : เลือกรูปจาก StockSnap.io</li><li>ขั้นสอง : อัพโหลดรูปลง Server</li><li>ขั้นสาม : เอา URL รูปไปใส่ใน Database</li></ul><p>แต่ว่าวิธีนี้ ถ้าทำนานๆ Server ก็จะเต็มไปด้วยรูป กินพื้นที่อีกหลายพัน MB จะขยายพื้นที่ก็มีต้นทุนเพิ่ม</p><p>จึงเกิด Architecture ทางเลือกที่สองขึ้นมา</p><h4>อัพเกรด กลายเป็น Model ตัวที่สอง</h4><p>Architecture ทางเลือกที่สอง นั้นคือ เอารูปไปภาพไว้ที่อื่น เว็ปฝากรูปในอินเตอร์เน็ตบนโลกนี้มันเยอะมากทั้งฟรีและไม่ฟรี</p><p>แน่นอนเราเลือกของฟรี แถมเราไปเจอของฟรีและดีด้วยนั้นคือ Flickr.com</p><p>Flickr.com นั้นให้เราอัพโหลดภาพเข้าไปได้ 1TB ฟรีๆ แถมอัพเข้าไปแล้ว ยังย่อภาพให้เราสามารถเลือกขนาดรูปไปใช้ได้ตามความเหมาะสม เรียกว่าครบครัน</p><p>ทำให้ Server ของเราเหลือแค่ API ที่ชี้ไปที่ตำแหน่งของรูปเท่านั้นเอง ขั้นตอนก็จะเปลี่ยนเป็นแบบนี้</p><ul><li>ขั้นแรก : เลือกรูปจาก StockSnap.io</li><li>ขั้นสอง : อัพโหลดรูปลง Flickr</li><li>ขั้นสาม : เอา URL รูปไปใส่ใน Database</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*s6J_F_s2TuuObZUWDx6tjQ.png" /><figcaption>มี Flickr มาช่วยแล้ว</figcaption></figure><p>willow watch face นั้นเลือกใช้ model นี้ต่อมา และใช้อยู่ซักพัก ระบบทำงานได้ไม่มีปัญหา แต่ปัญญามันไปเกิดที่…. คนดูแล ก็คือผมนี้แหละครับ</p><h4>ปัญหาที่ลำบากยิ่ง</h4><p>คนดูแลอย่างผมเนี่ยมีงานเพิ่มขึ้นอย่างหลีกเลี่ยงไม่ได้ โดยงานที่ต้องทำก็คือ เพราะทุกขั้นตอนที่กล่าวไปคืองานที่เพิ่มขึ้น และเวลาที่เสียไป</p><ul><li>ไปคัดรูปจาก<a href="https://stocksnap.io/"> https://stocksnap.io/</a> มา (เสียเวลาเลือก แถมเลือกที่ตัวเองชอบอีก)</li><li>อัพรูปไปที่เว็ป Flickr.com (login เข้า Flickr → ลากรูปลงไป → รอมันอัพโหลด)</li><li>ก้อปปี้ลิ้งจาก Flick ไปใส่ในดาต้าเบส (เปิดหน้าของภาพ →กดหา URL →copy URL →login เข้าดาต้าเบส → แล้ว insert ใส่ลงไปในตารางตรงๆเลย)</li></ul><p>API ของแอพก็จะดึงข้อมูลในตารางไปสร้าง json อีกทีแบบอัตโนมัติ</p><p>แม้ว่าจะเคยคิดจะทำ web portal ให้สามารถใส่ลิงค์ลงตารางง่ายๆ แต่ก็ยังไม่ได้ทำ</p><p>จากขั้นตอนที่กล่าวไป ก็จะมีขั้นตอนยิบย่อยอีกหลายอย่าง เช่น login database แล้วก็ login flick ก๊อปไป้ก๊อปมา ถ้าคัดมา 20 รูป ก็ก๊อปไปมา 20 รอบ</p><p>ทำได้ซักสามชุดก็เบื่อแล้ว ผลคือ online gallery จะอัพเดทนานๆครั้ง แถมต้องเข้าไปยุ่มยามกับ database ตรงๆบ่อยๆก็ไม่น่าจะดี เผลอลบอะไรไป อาจจะพังพินาศได้</p><p>ก็เลยเริ่มหาทางเลือกใหม่ ค้นพบว่า!</p><h4>จุดเริ่มต้นของ Model ตัวที่สาม</h4><p>Flick.com มี API ให้ใช้ !! ใช้ฟรีด้วย แถมรูปเราทั้งหมดก็อยู่บน Flickr.com ทำให้ง่ายต่อการย้ายสุดๆ</p><p>หลังจากไปงมและศึกษา Doc ของ Flickr API ก็ได้ model อัพรูปแบบลดขั้นตอนที่สะดวกขึ้นสุดๆ 100%</p><p>คือ Flickr นั้นสามารถให้เราเข้าถึงรายการรูปในอัลบัมผ่าน API ได้ ก็จัดการเชื่อมต่อ แอพเข้ากับ Flickr APIซะ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*i7f3ZCu4TPm5k0N90UTqSg.png" /><figcaption>ไม่ต้องใช้ Server ของตัวเองอีกต่อไป Flickr จัดการให้ทุกอย่าง</figcaption></figure><p>เวลาอัพเดทรูป เราก็แค่ไปคัดรูปมาจาก <a href="https://stocksnap.io/">https://stocksnap.io/</a> แล้วก็อัพลงไปในอัลบัม แค่นั้นก็จบขั้นตอน</p><ul><li>ขั้นแรก : เลือกรูปจาก StockSnap.io</li><li>ขั้นสอง : อัพโหลดรูปลง Flickr</li></ul><p>คัดมาร้อยรูปก็ ลากแล้ววางเข้าไปในฟอร์มอัพโหลดเลยร้อยรูป ที่เหลือ flickr จัดการอัพให้เองหมด</p><p>อัพโหลดเสร็จก็คือเสร็จ ไปทำอย่างอื่นได้ แอพเรากลายเป็น Serverless ไปในทันที ไม่ต้องเสียเงินอีกต่อไป</p><p>แล้ว model นี้ก็ถูกใช้ไปพักใหญ่ๆ แต่สุดท้ายก็กลับมาแนวเดิม คือไม่ได้อัพเดทสม่ำเสมอ อัพรูปบ้างนานๆที แม้ว่ามันจะง่ายกว่าเดิมแล้วก็ตาม เราก็ยังคงต้องเข้าเว็ปไปคัดรูป มาอัพโหลดลงใน Flickr</p><p>เหลืองานง่ายๆสองขั้นตอน แต่ว่าผ่านไปก็รู็สึกว่า มันน่าเบื่ออีกแล้ว และการที่เราเป็นคนไปคัดรูปมาเองนั้น ทำให้รูปที่อยู่ใน gallery จะมีสไตล์ซ้ำๆ ซึ่ง User ก็จะได้เลือกรูปที่เราเลือกมาแล้วอีกที</p><h4>มีปัญหาหรอ งั้นก็จัดการ อัพเกรดเป็น Model ใหม่ดิ!</h4><p>และแล้ว model ใหม่จริงเกิดขึ้นมา ที่เข้ามาเพื่อทำให้ Gallery เป็นอิสระต่อการอคติในการเลือกภาพของตัวผมเอง คือเอาไปผูกกับ API ของเว็ปที่เป็นคลังภาพเลย ทุกอย่างส่งตรงมาจาก แหล่งภาพชั้นดี ไม่ต้องไปเสียเวลาเลือก</p><p>ย้อนกลับไปที่ <a href="https://stocksnap.io/">stocksnap.io</a> ที่ใช้ประจำ เว็ปนี้มีรูปค่อนข้างมาก แต่ว่าไม่มี API ให้ใช้งาน ทำให้ต้องหาแหล่งรูปแหล่งใหม่ และแล้วก็ไปเจอกับ <a href="https://unsplash.com/">Unsplash</a></p><p>Unsplash นั้นเป็นเว็ปสต็อครูปภาพคล้ายๆ กับ <a href="https://stocksnap.io/">stocksnap</a> แต่ต่างกันตรงที่ Unsplash ที่มี API ให้เราสามารถดึงไปใช้ได้ฟรี ทำให้ Gallery ของเรามีฟีเจอร์เพิ่มขึ้นโดยไม่ต้องลงแรงไปเยอะ เช่น การ Search รูป</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*XLNk7CsbvMqoa8jQUwyTwQ.png" /></figure><p>และเราก็เป็นอิสระจากการไปอัพเดท Gallery และไม่มีงานน่าเบื่อให้ทำอีกต่อไป</p><p>เราจึงย้าย และเลือก Unsplash ให้เป็น gallery หลักของ Willow watch face</p><p>แต่ว่า Unsplash นั้นก็จำกัดจำนวน Request ที่ 5,000 request ต่อชั่วโมงซึ่งเมืี่อถึงกำหนด ก็จะไปดึงรูปไม่ได้ เราก็เลยแก้โดย ถ้า Unsplash API นั้นถึง limit แล้วเราก็จะย้ายไปดึงจาก Flickr API แทน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*nOph3JP_F2942_TTwV4_rA.png" /></figure><p>แต่ดูจากการใช้งานแล้ว เราคงยังห่างจาก limit นั้นอยู่เยอะ เพราะฉะนั้น Unsplash คงอยู่กับ Willow ไปอีกนาน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FAXsUR9McZ7x9yMshbd25A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BRlWjh4njMUZsQj_nOcxYA.png" /><figcaption>ซ้าย คือแบบเก่า ขวาคือ แบบใหม่</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d50fee73b2a2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/image-gallery-architecture-%E0%B8%81%E0%B8%B1%E0%B8%9A-willow-watch-face-d50fee73b2a2">Image Gallery Architecture กับ Willow watch face</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ประกอบคีย์บอร์ดใช้เองดีกว่า Part 1]]></title>
            <link>https://medium.com/ammarptn/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%AD%E0%B8%9A%E0%B8%84%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B9%80%E0%B8%AD%E0%B8%87%E0%B8%94%E0%B8%B5%E0%B8%81%E0%B8%A7%E0%B9%88%E0%B8%B2-part-1-aa5d44058519?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa5d44058519</guid>
            <category><![CDATA[custom]]></category>
            <category><![CDATA[pcb]]></category>
            <category><![CDATA[คีย์บอร์ด]]></category>
            <category><![CDATA[ประกอบ]]></category>
            <category><![CDATA[keyboard]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Sat, 26 May 2018 11:18:41 GMT</pubDate>
            <atom:updated>2018-05-26T15:52:27.173Z</atom:updated>
            <content:encoded><![CDATA[<p>คีย์บอร์ดเนี่ยถือเป็นอุปกรณ์ที่จำเป็นมากในการใช้คอมพิวเตอร์ หาซื้อได้ปกติทั่วไป ซึ่งมีตั้งแต่ราคาหลักร้อย ไปจนถึง Gaming Gear ราคา 5–6 พัน</p><p>แต่บางทีสิ่งที่เราอยากได้ก็หาซื้อไม่ได้ง่ายๆ เอาหล่ะ สรุปได้ง่ายๆว่า บทความนี้เราจะมาประกอบคีย์บอร์ดใช้เอง</p><p>ก่อนจะมาทำใช้เอง ผมก็ซื้อคีย์บอร์ดอันแพงๆมาใช้เหมือนปกติทั่วไปนั้นแหละ เริ่มจาก Full size แล้วก็ย่อลงมาเหลือ Tenkeyless (ก็คือขนาดปกติแต่ไม่มีปุ่มตัวเลขด้านขวา) แล้วก็ย่อไปจนเหลือ ขนาดที่เรียกว่า 60%</p><p>ขนาด 60% คือตัด ปุ่มตัวเลขด้านขวา ปุ่มลูกศร ปุ่ม Function ข้างบนออกไป</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*gTFal5wxEa0Lgee0f6UNMg.png" /><figcaption>60% keyboard</figcaption></figure><p>ในตอนแรก ผมก็เคยคิดว่า Keyboard เล็กแบบนั้น มันจะใช้ใช้งานได้หรอ แค่ไม่มีปุ่มลูกศรก็ลำบากแล้ว แต่พอได้ซื้อมาลอง ก็พบว่ามันก็เวิร์คนะ เล็กๆกระทัดรัด ไม่กินที่ ส่วนปุ่มลูกศร ก็ต้องกดใช้พร้อมกับปุ่ม Fn พอใช้ไปซักพักก็จะเริ่มชิน จนไม่รู้สึกลำบากแต่อย่างไร</p><p>แต่ว่าคีย์บอร์ดแบบนี้ไม่ได้หาซื้่อได้ง่าย เพราะมันไม่ได้ขายได้กับคนใช้งานทั่วๆไป แถมถ้ามีขาย ราคาก็แพงขึ้นกว่าคีย์บอร์ดทั่วไปมากมาย และตัวเลือกก็น้อยอีกด้วย</p><p>สุดท้ายการเลือกที่จะประกอบเองถือเป็นทางออกหากต้องการความ customize แบบไม่มีใครให้ได้</p><p>ในการประกอบคีย์บอร์ด เราสามารถเลือกได้ว่าอยากได้ ขนาดไหน สำหรับผม หลังจากได้ลอง 60% keyboard ก็พบว่ามันลงตัวสำหรับผม บทความนี้เลยจะมาประกอบ 60% keyboard ให้ดูกัน</p><p>อย่างแรกที่ผมซื้อมาคือ PCB หรือแผงวงจร</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUTfwytWQeQst7iCtWzyZg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ED0zt13P_KDmROGrb9fePQ.jpeg" /><figcaption>PCB ขนาด 60%</figcaption></figure><p>PCB นี้ผมสั่งมาจากจีน เพราะไม่สามารถหาได้ทั่วๆไป ตัวนี้ เป็น Model ชื่อ DZ60</p><p>อันที่จริง ตัว PCB ก็จะมีตัวเลือกค่อนข้างหลากหลาย ขึ้นอยู่กับว่าเราอยากได้ Keyboard layout แบบไหน ราคาก็มีตั้งแต่ สามร้อยกว่าบาทไปจนถึง หลายพัน ยิ่งแพงความสามารถก็จะยิ่งเยอะ</p><p>(ก่อนลงมือ ให้ลองทดสอบก่อนว่ามันใช้ได้ทุกปุ่ม โดยการเสียบเข้ากับคอมพิวเตอร์ แล้วหา คีมหรือ คลิปหนีบกระดาษมาช้อตวงจรของปุ่มนั้น ปกติผมใช้ โปรแกรม switch hitter หรือไม่ก็เว็ป <a href="http://www.keyboardtester.com/tester.html">http://www.keyboardtester.com/tester.html</a> ในการทดสอบ)</p><p>อย่างที่สองที่ผมซื้อมาก็คือ plate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVhPCPXjLLcOzy5FA8M-qw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*53lTmPoRcxH8-tXVZjl7ug.jpeg" /></figure><p>Plate นี้จะเป็นตัวที่ไว้สำหรับยึดปุ่มคีย์บอร์ด ซึ่งไม่จำเป็น แต่ถ้ามีก็จะทำให้คีย์บอร์ดของเราแข็งแรงขึ้น ถ้าไม่อยากใช้เราก็ เอาปุ่มคีย์บอร์ดใส่ลงไปบนแผงวงจรตรงๆก็ได้</p><p>อย่างที่สามก็คือ keyboard stabilizer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RFMahpWytA7vx8Gj7OOpaA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*db1V-Ua1psLAl7aHxqWL0w.jpeg" /></figure><p>หน้าที่ของมันก็จะมีเอาไว้พยุงปุ่มคีย์บอร์ดที่ยาวกว่าปกติ เช่น ปุ่ม Spacebar , enter shift, etc ซึ่งถือว่าจำเป็น ถ้าไม่มีเราก็จะกดปุ่มยาวๆพวกนั้นลำบาก</p><p>อย่างที่สี่ คือ switch หรือปุ่มคีย์บอร์ด ซึ่งในโลกนี้มีตัวเลือกเยอะมาก ไม่ว่าจะเป็นแบบกดแล้วมีเสียง กดแล้วไม่มีเสียง กดแล้วมี feedback แม้กระทั่งน้ำหนักในการกด ซึ่ง เป็นปัจจัยสำคัญ ที่ทำให้คนเลือกที่จะมาประกอบคีย์บอร์ดเองกัน เพราะว่าเราชอบแบบไหนเราก็เลือกแบบนั้นมาใช้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SwTtBdBy_yUn9VqeRwmPjQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C6h8I1FosMY5dHwWhJjOpQ.jpeg" /></figure><p>ในรูปจะเป็น zealios switches กดแล้วไม่มีเสียง แต่จะมี tactile เวลาเรากด</p><p>อย่างที่ ห้าคือ เคสสำหรับใส่คีย์บอร์ดที่รักของเรา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdIMXV-r7wltyQzpi58Cqg.jpeg" /></figure><p>เคสนี้ก็ตัวเลือกเยอะเช่นกัน โดยหลักๆจะออกแบบรูสกรูมาเป็นมาตรฐาน นอกนั้นก็จะแล้วแต่คนออกแบบ ซึ่งจะมีทั้งแบบพลาสติก อลูมิเนียมหรือแม้กระทั่งไม้ แล้วแต่ใครจะชอบอะไรก็เลือกได้ตามใจ</p><p>อย่างที่หก คือ คีย์แคป (keycap)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kUJb_EiXrEgBuWS7nJ0xmQ.jpeg" /></figure><p>ตัวเลือกสำหรับคีย์แคปนั้นมีมากมายเกินจะบรรยายไหว ใครชอบสไตล์ไหน สีอะไร น่าจะหามาใส่กันได้ไม่ยาก เอาเป็นว่ามีทุกสีแน่นอน</p><p>หลักจาก อุปกรณ์ครบแล้ว เราก็มาเริ่มขั้นต่อไปกันคือการ ประกอบมันขึ้นมา</p><p>ซึ่งอุปกรณ์ที่จำเป็นก็จะมี</p><p>หัวแร้ง สำหรับ บัดกรีและตะกั่วสำหรับบัดกรี</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSlpxIN-IZzcP4yhO9Rpew.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHsDxz04RtvE-Woi9LtmCw.jpeg" /></figure><p>สำหรับอุปกรณ์อื่นๆ ในการบัดกรีถ้ามีก็จะง่ายขึ้นเช่น ฟองน้ำ ที่วางหัวแร้ง Flux</p><p>อุปกรณ์พร้อมแล้วเราก็จะเริ่มประกอบกัน</p><p>ขั้นแรกคือการใส่ stabilizer ให้กับ PCB ซึ่ง stabilizer จะมีอีกแบบที่ใส่กับ plate แต่ผมไม่ได้ใช้แบบนั้น ผมเลือกแบบใส่กับ PCB ที่ใช้สกรูขัน ก็จะง่ายๆหน่อย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTd2gFBhrhtgoeitV4IT8A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xJmkYIRwsKdEgfu-yc-BQ.jpeg" /></figure><p>PCB บางรุ่นที่แปลงได้หลาย layout ก็จะต้องดูให้ดีๆว่าใส่ถูกช่องหรือเปล่า ถ้าไม่แน่ใจก็เอา plate มาทาบดู แล้วลองเอาปุ่มมาใส่ว่ามันพอดีกันหรือเปล่า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cWDuio0W4wX5Qtw-_wI-Dg.jpeg" /><figcaption>พอดีทุกช่อง ไม่มีเบียดกัน</figcaption></figure><p>ขั้นต่อไปคือใส่ switch ลงไป ให้ขาทะลุ PCB ออกมาอีกด้าน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2eozKQf4Yf10w_yP0OLY_Q.jpeg" /></figure><p>แล้วก็พลิกอีกด้าน เตรียมหัวแร้งกับตะกั่วให้พร้อม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJpFHtat4_TRxONWgCzbtw.jpeg" /></figure><p>เนื่องจากว่า ไม่มีใครช่วยถ่ายรูปตอนบัดกรี เลยไม่มีรูปตอนกำลังจี้ตะกั่ว แต่คิดว่าไม่น่าจะยาก ถ้าใครไม่เคยลองทำให้ลองเปิด YouTube ดูก่อนพลางๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X8UTvFAAtI57vpGKumB9Gw.jpeg" /></figure><p>เสร็จแล้วหนึ่งปุ่ม</p><p>หลังจากนั้นก็ทำให้ครบทุกปุ่ม ก็จะใกล้พร้อมใช้งานแล้ว</p><p>เสร็จแล้วก็เอามาใส่เคส ใส่ keycap</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1yxCoXktFsMYsEEhUleGFg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyQIN6x9BdQB-7XUzvFHNw.jpeg" /></figure><p>เสียบสายแล้วก็ลองทดสอบอีกรอบว่า มันใช้งานได้ปกติทุกปุ่มไหม ถ้าบางปุ่มไม่ติด ให้ลองเติมตะกั่วให้ปุ่มนั้นอีกรอบ</p><p>จบแล้วสำหรับขั้นตอนการประกอบ ในขั้นนี้คีย์บอร์ดก็จะพร้อมใช้งานทั่วๆไปแล้ว แต่ถ้าใครยังต้องการความลงตัวแบบไม่มีใครเหมือน ในตอนต่อไปจะ อธิบายเกี่ยวกับ Software ที่จะทำให้เราสามารถตั้งค่าปุ่มใหม่ให้มันทำงานได้แบบที่เราต้องการ และนั้นคือการใช้งาน QMK open source สำหรับ flash keyboard ของเราครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa5d44058519" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%AD%E0%B8%9A%E0%B8%84%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B9%80%E0%B8%AD%E0%B8%87%E0%B8%94%E0%B8%B5%E0%B8%81%E0%B8%A7%E0%B9%88%E0%B8%B2-part-1-aa5d44058519">ประกอบคีย์บอร์ดใช้เองดีกว่า Part 1</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Side project : Willow watch face ตอน Online font gallery]]></title>
            <link>https://medium.com/@ammarptn/side-project-willow-watch-face-%E0%B8%95%E0%B8%AD%E0%B8%99-online-font-gallery-aed597855d95?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/aed597855d95</guid>
            <category><![CDATA[face]]></category>
            <category><![CDATA[watches]]></category>
            <category><![CDATA[willow]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Sun, 11 Mar 2018 07:55:29 GMT</pubDate>
            <atom:updated>2018-03-11T07:55:29.239Z</atom:updated>
            <content:encoded><![CDATA[<h4>บันทึกการพัฒนา Willow watch face ตอน Online font gallery</h4><h4>Willow watch face ?</h4><p>Willow คือหนึ่งในแอพนาฬิกาบน Android wear ที่ผมออกแบบและทำไว้ โดยฟีเจอร์หลักๆเลยก็คือ ส่งภาพบนมือถือไปตั้งเป็นภาพพื้นหลังบนนาฬิกาพร้อมสามารถเปลี่ยน font ได้ตามใจ ซึ่งเคยติดอันดับ Chart ของ Google play ในส่วนของ Noteworthy Picks — Watch face we love กับ Hand-Picked Watch Faces อยู่พักนึง</p><h4>การเปลี่ยน font ของ Willow watch face</h4><p>ผมเห็นแอพมาหลายแอพนะครับที่คล้ายๆกันที่สามารถเปลี่ยนพื้นหลังนาฬิกาได้ แต่ยังไม่เคยเห็นฟีเจอร์นี้มากเท่าไหร แต่ว่า willow watch face นั้นมี!! ซึ่งผมว่าฟีเจอร์ที่เราสามารถเปลี่ยน font ที่ชอบเองได้คือหนึ่งในจุดขายของแอพนี้ เปิดให้ผู้ใช้เปลี่ยนเป็นรูปแบบไหนก็ได้ที่เค้าชอบ ยังไงก็ชนะใจเสมอ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*9IlKYjjAP4gGQa2adKqeLg.gif" /></figure><p>แต่การเพิ่ม font เข้าไปในรายการให้ผู้ใช้เลือกนั้นไม่ได้ง่าย</p><p>Font แต่ละอันจะมี Copyright อย่างเช่นการห้ามนำไปแจกจ่ายโดยไม่ได้รับอนุญาติทำให้ผมไม่สามารถไปโหลด font มาเก็บไว้แล้ว ให้คนเลือกเป็นรายการได้ แต่สิ่งที่ทำได้คือ ในผู้ใช้นั้นโหลดเองแล้วเพิ่มเข้าไปเอง</p><p>วิธีง่ายๆก็คือ เสียบมือถือกับคอม แล้วก็ลากไฟล์ font ไปวางใน folder ในมือถือ ซึ่งที่เหลือ willow ก็จะไปจัดการดึงข้อมูลมาแสดงในแอพเอง หรือจะไปกดโหลดมาจาก Google drive ก็ยังได้</p><p>แต่การที่ต้องเพิ่มเข้าไปเองนี้แหละ แม้จะออกแบบมาให้ง่ายที่สุด แต่ก็ยังมีผู้ใช้ที่ทำไม่เป็น ซึ่งก็มีหลายกลุ่ม เช่นคนแก่ที่อายุเยอะ ไม่เข้าใจวิธีการ ซึ่งกลุ่มนี้น่าเห็นใจ และก็มีกลุ่มที่ไม่ยอมอ่านคำแนะนำ แล้วทำไม่เป็น แล้วก็ให้เรตติ้งต่ำๆก็มี</p><p>ปัญหานี้แก้ได้ไม่ยากคือการสร้างศูนย์รวม หรือ เป็น font gallery ไว้ภายในแอพ แต่เนื่องจากเราไม่ใช้เจ้าของ font และการตั้ง gallery ก็ต้องมี Server ไว้ให้คอยบริการ</p><p>มี Server ก็คือต้นทุนเพิ่ม แต่ willow watch face นี้ไม่ได้สร้างรายได้ทางตรง ไอเดียการตั้ง server ให้คนโหลด font จึงโดนโยนทิ้งไป</p><h4>สุดท้าย font gallery ก็ได้เกิด</h4><p>เพราะวันนึง มีผู้ใช้ส่งอีเมล์มา ว่าเค้าอยากได้ font gallery จริงๆนะ ซึ่งแม้จะมีวิธีเพิ่ม แต่เค้าก็แก่เกินจะทำความเข้าใจ ทำให้สุดท้าย ฟีเจอร์ font gallery ก็ถูกเริ้อฟื้นอีกรอบ แล้วก็เริ่มเก็บข้อมูลหาความเป็นไปได้</p><h4>ทางเลือกแรกที่มาโปรด</h4><p>หลังจากลองหาข้อมูลไปเรื่อยๆ หนึ่งในตัวเลือกที่ดีที่สุดที่ผุดขึ้นมาในหัวคือ font ที่ Google ปล่อยให้โหลดไปใช้ฟรีๆ ซึ่งเราคิดว่าระดับ Google แล้ว ต้องมี API ให้ใช้แน่นอน ซึ่งเราก็ไปเจอมาจริงๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0RXu5akHJ-vLtZwTWkyDUg.png" /><figcaption>Google มีในคลังตัวเองประมาณ 800 กว่าแบบ</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6z1CqDpzmCF7SUxruYsJA.png" /><figcaption>ใช้ฟรี มี API ให้ด้วย</figcaption></figure><h4>แหล่งทรัพยากรพร้อม ขั้นต่อไปคือการออกแบบ</h4><p>หลังจากเห็นหนทางของการสร้างแล้ว ขึ้นต่อไปก็คือออกแบบ UI สำหรับ font Gallery</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHGuk9AzRGs-RgAbskMiBQ.png" /></figure><p>เป้าหมายก็คือใช้ง่ายเข้าใจง่าย หน้าตาดี ซึ่ง ออกแบบ UI นี้ไม่ได้ยากเท่าไหรนัก เมื่อเปิด Gallery ก็จะเจอ font หลายๆอัน พร้อมรูปแบบพรีวิวของ font ก่อนโหลดไปใช้ สิ่งที่สำคัญอีก หนึ่งอย่างก็คือ UX</p><p>UX คือตัวย่อของ User experience ซึ่งเป็นหนึ่งในหลักสำคัญที่จะทำให้แอพนั้นสามารถใช้งานได้ง่าย ซึ่งการที่ font นั้นแสดงตัวอย่างตัวอย่างรูปแบบได้ ก็คือ 1 ในการออกแบบ UX</p><blockquote>ลองคิดดู ถ้าคุณต้องโหลด font ไปใช้ โดยไม่รู้ว่ามันหน้าตาเป็นอย่างไร จะหงุดหงิดแค่ไหน</blockquote><p>เมื่อ ออกแบบหน้าตาเสร็จแล้ว ขั้นต่อไปก็คือ เริ่มลงโค้ดพัฒนาจริง แต่ใช้ว่าการออกแบบจะจบไปแล้ว เพราะเรายังต้องออกแบบโครงสร้างของฟีเจอร์อีกด้วย</p><p>หนึ่งในไอเดียที่คิดไว้คือ แอพไปดึงรายการ font จาก Google font มา แล้วเราก็เอารายการ font มาแสดงใน gallery พร้อมพรีวิวรูปแบบ font เพราะ Google font มี API ให้ใช้ฟรี!</p><p>แต่! เมื่อลงรายละเอียดเข้าไปในโครงสร้าง ก็เจอปัญหาอย่างนึง คือ เราไม่สามารถใช้ Textview แสดงตัวอย่าง font ที่อยู่บนอินเตอร์เน็ตได้!!</p><p>แต่การพรีวิวคือหนึ่งในปัจจัยสำคัญที่ไม่สามารถตัดออกไปได้ ก็เลยต้องไปลองหาวิธีอื่นๆ</p><p>ซึ่งพบว่าถ้าเราต้องการดึงรูปแบบ font จาก internet เราสามารถใช้ webview แทนได้ เพื่อทดลองการทำงานก็เลยลองเขียนโค้ด ดึง font จาก internet มาแสดง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*kJUvlapCLuRE6mMQv5UVbQ.png" /></figure><p>โอ้ว ได้จริงๆด้วย แต่ในใจก็ยังมีข้อกังขาเมื่อต้องเรียกมาแสดงหลายๆอัน กลัวว่ามันจะโหลดทุกครั้ง เปลืองอินเตอร์เน็ตแย่ แต่ไหนๆก็ไหนๆ ได้แบบนี้แล้วก็ลองไปก่อน</p><p>จึงเริ่มเอา webview ไปใส่ทุกช่องที่จะแสดงตัวอย่าง font</p><p>ผลที่ได้คือ Bug แสดงรูปแบบซ้ำกัน ไม่ถูกต้อง ซึ่งหนึ่งสิ่งที่คิดไว้คือ การโหลด font ผ่านอินเตอร์เน็ตน่าจะมีปัญหาโหลดไม่ทัน มันก็เลยแสดงซ้ำอันที่โหลดทัน</p><p>ด้วยความสงสัยเลย โหลด font ทั้งหมดใน Google font มาดู พบว่า ทั้งหมดใช้ขนาดเกือบๆ 100 MB</p><p>ซึ่งเป็นไปไม่ได้แน่นอนที่จะโหลด 100 MB ระหว่างเลื่อนหน้าจอไปๆมาให้ทัน จึงต้องเปลี่ยนโครงสร้างฟีเจอร์นี้แทน</p><p>รูปแบบโครงสร้างฟีเจอร์ใหม่ที่คิดไว้คือ เปิดครั้งแรก font gallery เราก็จะโหลด font ทุกตัวใน Google font มาแคชเก็บไว้บนเครื่อง แล้วก็ไปดึงจาก แคชมาแสดงแทน (ไม่มีทางเลือกแล้วในตอนเขียนแอพขณะนั้น)</p><p>แต่แม้จะเอา font มาแคชไว้บนเครื่องแล้วถ้ายังดึงผ่าน webview ผลที่ได้ก็ยังพังเหมือนเดิม เลยเปลี่ยนกลับเป็น Textview</p><p>ขั้นแรกคือ โหลดไฟล์ font ทั้งหมด ใช่เวลาประมาณ 2 นาทีสำหรับเน็ตแรงๆ ถ้าเน็ตไม่แรง ก็จะรออีกนาน เลยเขียนเช็คไว้ว่า ถ้าโหลดผ่าน Mobile Data จะแจ้งเตือนก่อน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sZZ4F6Z_FiXanc_MrIep_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bSADY0tFlBEEnCveNwNFlg.png" /></figure><p>เมื่อโหลดเสร็จ เราก็เข้าไปใน folder cache แล้วเอาไฟล์ font ทั้งหมดที่มีอยู่ใน folder นั้นมาแสดงผลใน list</p><p>ซึ่งผลที่ได้คือ font ทุกตัวแสดงตัวอย่างได้แล้ว ไวกว่าวิธีก่อนๆมาก</p><p>ก็ถือว่า feature font gallery ก็เป็นอันเรียบร้อย ข้อเสียอย่างเดียวคือ แอพก็จะบวม ไปอีก 100 MB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dhwho5WATam2wEZ8Ga7kVQ.png" /></figure><p>หาก Google มีการ update แอพก็จะเช็ค hash ของ response ที่เคยได้ กับ response อันใหม่ที่ได้จาก google</p><p>ถ้าไม่ตรงกันก็อัพเดทรายการ font กันไป</p><p>อีกทางเลือกหนึ่งคือใช้ font preview เป็นภาพแทน ซึ่งจะแก้ปัญหาที่มีอยู่ได้แต่ก็ต้องไปเขียน code ในด้าน backend เพิ่ม ซึ่งจะซับซ้อนไปอีก ถ้าอยากให้มันอัพเดทตรงกับจำนวน font ที่มีอยู่ใน Google font</p><p>ระหว่างนี้ก็ใช้วิธีนี้ไปก่อนละกัน</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aed597855d95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Story: Willow watch face #1]]></title>
            <link>https://medium.com/ammarptn/project-story-willow-watch-face-1-f7122b3b243e?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7122b3b243e</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[willow]]></category>
            <category><![CDATA[watchface]]></category>
            <category><![CDATA[ammarptn]]></category>
            <category><![CDATA[wear]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Fri, 28 Apr 2017 14:54:12 GMT</pubDate>
            <atom:updated>2017-04-28T14:55:32.690Z</atom:updated>
            <content:encoded><![CDATA[<h4>ภาค 1 : Willow watch face คืออะไร?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3YlraxBL5t9lZ3Aznm4AuQ.png" /></figure><p>willow watch face คือ แอพพลิเคชั่นอันหนึ่งที่ผมทำไว้สำหรับนาฬิกา Smart watch ที่เป็น Android wear ซึ่งมันก็คือหน้าปัดนาฬิกาดีๆนี้เอง</p><p>จุดเด่นของ Smart watch โดยทั่วไปแล้วเนี่ยก็คือ หน้าปัดนาฬิกา ที่คนใส่สามารถเลือกเปลี่ยนได้ตามใจชอบ การสร้างอะไรซักอย่างเพื่อสนองความชอบหรือสไตล์ของคนเลยดูน่าสนุก เพราะมันเป็นอะไรที่ไม่เคยทำ</p><h4>งานออกแบบมันไม่ง่าย</h4><p>การออกแบบถือเป็นงานที่ไม่ง่ายเท่าไหร เพราะแต่ละคนก็มีสไตล์ไม่เหมือนกัน เพราะฉะนั้น เราจึงยึดจุดนี้มาสร้างเป็นจุดแข็งของแอพหน้าปัดเรา คือการปล่อยให้ผู้ใช้เป็นคนเลือกเองเลยว่าจะใช้รูปอะไรเป็นพื้นหลัง เราแค่สร้างแอพหน้าปัดที่ ให้คนเข้าไปเลือกรูป แล้วส่งไปเป็นพื้นหลังของนาฬิกา ก็เท่านั้นเอง</p><h4>Feature#1 เปลี่ยนภาพพื้นหลังของหน้าปัด</h4><p>ในตอนนั้นหน้าปัดที่สามารถเอารูปในมือถือมาตั้งเป็นพิ้นหลังหน้าปัดนั้นมีไม่มาก ซึ่งหมายความว่าแอพเรานั้นไม่ได้เป็นอะไรใหม่ สิ่งสำคัญคือการออกแบบให้มันใช้งานง่ายๆ ก็คิดว่าสู้แอพที่ทำมาคล้ายๆกันได้แน่นอน</p><p>เริ่มต้นที่ แอพตั้งค่าของหน้าปัดบนมือถือ โดยเริ่มต้นออกแบบ ก็นึกถึง Material Design Guideline ของ Google ที่แนะนำไว้ เลยลองไปเปิดอ่านดู</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*szIhXyHlA3j4LF0Bm9K_Bw.png" /></figure><p>ทุกอย่างลงตัวไปหมดจริงๆ ผลก็คือ หน้า UI หน้าแรก ก็ออกมาเหมือนตัวอย่างใน Guideline เป๊ะๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upbDuxJgVWTdabAbLwfjmA.png" /></figure><p>ในหน้าแอพจะแบ่งเป็น 3 ส่วน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yXYJYHFpYLHnMMCApFJUvg.png" /></figure><p>ส่วนแรกคือ <strong>Preview</strong> ซึ่งจะเอาไว้แสดงตัวอย่างภาพและฟอนต์ที่จะไปแสดงจริงบนหน้าฬิกา</p><p>ส่วนที่สองคือ <strong>Album รูปภาพ </strong>ของ willow ที่สามารถเลือกไปแสดงบนหน้าปัดได้</p><p>ส่วนที่สามคือ <strong>Configuration </strong>ที่ไว้แสดงรายการตั้งค่าต่างๆที่สามารถเปลี่ยนแปลงได้ จะมีกี่รายการก็เลื่อนดูได้</p><p>อีกส่วนที่สำคัญอีกหนึ่งอย่างก็คือปุ่มบวก สีส้ม ซึ่งเมื่อกดไปแล้วจะพาไปหน้า Online Gallery ซึ่งผู่ใช้สามารถเข้าไปดูไปโหลดภาพมาใช้ได้</p><p>เมื่อผู้ใช้เลือกรูป มันก็จะส่งภาพไปที่นาฬิกาที่เชื่อมกับมัน แล้วก็เปลี่ยนรูปไปตามรูปที่เลือกทันที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*ua3O5JrpjaZkika9JSoJgQ.gif" /><figcaption>เมื่อมีการเลือกภาพ สีพิ้นหลังของเมนูตั้งค่าก็จะเปลี่ยนไปตามโทนสีของภาพด้วย</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*jhe1s3V0BqM1ej6d7cdz0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*toZKatUrNk3RLFAZD_XrnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*hpGpFDXnypPA9FATUuk6WA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hQLR6Pujs5VtICwTMibZvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5eI5NkShzc-3JW4X-gzP5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqGEyh9F5xap9kaljW402Q.png" /><figcaption>จอกลม หรือ เหลี่ยมก็ได้หมด</figcaption></figure><h4>มาดูกันที่ gallery รูปบ้าง</h4><p>ใน Gallery รูปเมื่อเปิดเข้าไปก็จะเจอรูปภาพสวยๆ ที่ไว้ให้ผู้ใช้ดาว์นโหลดไปใช้ได้ เมื่อดาว์นโหลดไปแล้วก็จะเข้าไปอยู่ในรายการ พร้อมที่จะส่งไปยังนาฬิกาเมื่อถูกเลือก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cmpgza7ULuKK90QU1p3BSg.png" /></figure><p>ในตอนแรก รูปทั้งหมดนั้นวางไว้ในเซิฟเวอร์ที่เช่าเอง แล้วก็ทำ API ให้แอพเข้าไปดูที่อยู่รูปเพื่อเอามาแสดงใน Gallery ซึ่งทำได้ซักพักก็ขี้เกียจ เพราะว่าต้องไปหารูป อัพรูป อัพเดทฐานข้อมูลเอง ไม่มีระบบ backend ใดๆช่วยในการจัดการรูป</p><p>เมื่อขี้เกียจจนถึงขีดสุด ก็จะปลดล็อคความสามารถใหม่ขึ้นมา โดยไปหาเว็ปฝากรูปดีๆ ที่มี API ให้ใช้ แล้วก็ย้ายรูปทั้งหมดไปไว้ในนั้น ซึ่งเว็ปที่ไปฝากก็คือ <a href="https://www.flickr.com/">https://www.flickr.com</a> เพราะมันค่อนข้างง่าย และช่วยลดขั้นตอนทั้งหมดไปได้เยอะ เหลือแค่ ไปเลือกรูปมาอัพลง ในอัลบัมของ Flickr แอพก็จะเห็นรูปที่อัพไปทั้งหมดทันที</p><ul><li>รายละเอียดของการทำระบบ online gallery อาจจะเขียนแยกไว้อีกบทความนึง</li><li>ในทางกลับกัน ถ้าผู้ใช้ไม่อยากใช้รูปที่เราเตรียมไว้ให้แต่อยากเลือกรูปที่อยู่ในมือถือ ก็สามารถทำได้ โดย Tab ข้างๆ ก็จะเป็นส่วนสำหรับเลือกภาพจากเครื่อง สามารถเลือกภาพอะไรก็ได้ ซึ่งในแอพนั้นมีวิธีเพิ่มรูปได้หลายทาง ซึ่งทำได้แบบเนียนๆ ซึ่งจะแยกเป็นอีกบทความเช่นกัน</li></ul><p>ในส่วน gallery รูปก็มีเท่านี้ ไว้มาต่อบทต่อไปกับ Feature ต่อไปละกัน</p><p>ถ้าใครสนใจก็เข้าไปโหลดได้ที่ Google Play store หรือกดลิ้งค์ข้างล่างได้เลย</p><p><a href="https://play.google.com/store/apps/details?id=com.ammarptn.willow.digital.watch.face">Willow photo watch face for Android wear</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VrCBh1KS5zKOKWyB57ntrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJ371wj91HBVZ6Wc6NcwHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mu1jvDV6qsdde-g-Y8RGqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbFeEo0D2u0xG8clknbhbg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HfVJVyheMXiQQQvWS00erg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AcisyjHcp3rce5uaX-L35w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7122b3b243e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/project-story-willow-watch-face-1-f7122b3b243e">Project Story: Willow watch face #1</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เช็คการเปิดใช้งาน Promotion code ของ App เราอย่างไรให้เร็วและมีประสิทธิภาพ ด้วย Burp suite]]></title>
            <link>https://medium.com/ammarptn/%E0%B9%80%E0%B8%8A%E0%B9%87%E0%B8%84-promotion-code-%E0%B8%82%E0%B8%AD%E0%B8%87-app-%E0%B9%80%E0%B8%A3%E0%B8%B2-4d534a3f959f?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d534a3f959f</guid>
            <category><![CDATA[promotion]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[burpsuite]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Wed, 01 Mar 2017 05:57:56 GMT</pubDate>
            <atom:updated>2018-03-20T08:55:00.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*PxvSL1OUyrC1L6X9iDfMDg.png" /></figure><h4>คำนำ — บทความนี้เป็นบทความที่ค่อนข้างจะเฉพาะทางในทางด้าน Android ผสม กับ Marketing ผสม Hacking ที่อาจจะมีประโยชน์ต่อคนในจำนวนน้อย คนทั่วไปอาจจะอ่านไม่เข้าใจไปเลย ถ้าอ่านไม่เข้าใจก็ยังถือว่าคุณเป็นคนปกติอยู่</h4><h4>Promotion code คืออะไร ?</h4><p>แอพโทรศัพท์มือถือที่ทำขายทั่วๆไปบน Google play เนี่ย Dev นั้นจะได้สิทธิในการสร้าง Promotion code เอาไปแจกฟรี เพื่อให้คนที่ได้ไปสามารถเอา Promotion code ไปแลกฟรีโดยไม่ต้องเสียตังซื้อ ถือเป็นโปรโมตแอพแบบนึง โดยไม่ต้องเสียตังลงโฆษณา คนได้ไปก็ไม่ต้องเสียตังซื้อแอพ ถือว่า win-win กันไป โดย Dev เนี่ยสามารถสร้าง Promotion code แจกแอพฟรี 500 โค้ด ต่อสามเดือน(1 ไตรมาตร) และเป้าหมายสำคัญของการแจก คือ การเพิ่มยอดดาว์นโหลดให้แอพ หรือเอาไปทำการตลาดแล้วแต่จะสะดวก</p><p>แต่ว่าการที่มันจำกัดที่ 3 เดือนต่อ 500 โค้ด ทำให้มันค่อนข้างมีคุณค่ามาก เมื่อได้รับแจกแล้วก็ควรเอาไปแลก</p><h4>Promotion code กับปัญหาการดองของคน…</h4><p>แต่ว่า ในโลกแห่งความเป็นจริง เมื่อ Dev ยอมหว่านแห แจก โค้ดไปแล้ว ยังมีพวกที่ยังรับโค้ดไป แต่ไม่เอาไปแลก ดองไว้นั้นแหละ ซึ่งมันก็จะเป็นปัญหา เพราะว่าโค้ดที่แจกไปมันมีจำกัด แจกไปหมดแล้ว แต่ถูกเปิดใช้งานไม่หมด ยอดดาว์นโหลดก็ไม่ขึ้น ปล่อยไว้นานๆโค้ดก็จะหมดอายุ เหมือนเอาโค้ดไปทิ้งเปล่าๆ แถม Dev ก็จะสร้าง Promotion code ขึ้นเพิ่มไม่ได้อีกถ้ายังไม่ครบ 3 เดือน</p><h4>การเช็คว่า Promotion code ถูกเปิดใช้งานหรือยังทำไง?</h4><p>การเช็คโค้ดว่าอันไหนยังไม่ถูกเปิดใช้งานแล้วนำมาแจกใหม่ให้คนอื่นๆอีกรอบ จึงเป็นทางออก แต่ทว่าใน Google play ยังไม่มีเมนูใดๆช่วยเช็คให้ว่าโค้ดไหนมีคนแลกไปแล้ว คนไหนยังไม่แลก มีแต่แสดงว่า โค้ดชุดนั้นคนแลกไปแล้วกี่คน ซึ่งเราไม่ต้องการตรงนั้น</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arOEl3peCtnWplvoCfpnkA.png" /><figcaption>โปรโมชั่นรอบนี้ นั้นแจกโค้ดไปหมดแล้ว แต่ว่าคนเปิดใช้งานยังไม่เต็ม แสดงว่า มีคนที่เอาไปดองไว้ ถ้าไม่ทำอะไรเลยก็จะได้ยอดดาว์นโหลดแค่ 434 คนเอง ในขณะที่ แจกออกไปตั้ง 1000 ชุด เฉลี่ยแล้วไม่ถึง 50 % ด้วยซ้ำ</figcaption></figure><h4>การเช็คว่า Promotion code ถูกเปิดใช้งานหรือยังแบบดิบเถื่อน…</h4><p>วิธีแบบง่ายๆเลยก็คือ เปิด Google play store ไปที่เมนูแลก แล้วใส่โค้ดลงไป</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKXu1yrU-QCx3EZY2koSXg.png" /></figure><p>ถ้าโค้ดถูกใช้แล้วก็จะขึ้นว่า โค้ดถูกใช้แล้ว ถ้ายังไม่ถูกใช้ก็จะขึ้นให้เรากดแลกไปได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQdah-mj47pMyf-hYirqmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7beaQnNB1rg_mTQh-wWuUg.png" /><figcaption>ขึ้นแบบซ้ายหมายถึงว่าโค้ดนั้นมีคนแลกไปแล้ว แต่ถ้าขึ้นแบบขวา แสดงว่าโค้ดยังเอาไปใช้ได้</figcaption></figure><p>ปัญหาต่อไปคือ ….โค้ดนั้นมีไม่ใช่น้อยๆ ถ้าแลกจนหมดโค้วต้า ก็แปลว่าเรามี 500 โค้ด เราต้องทำแบบนี้ไป 500 ครั้ง เพื่อเช็คทุกโค้ดว่า อันไหนใช้ไปแล้วบ้าง</p><p>และในหนึ่งปี เราสร้างได้ทั้งหมด 2000 โค้ด นั้นก็หมายความว่า เราอาจจะต้องทำแบบนี้ซ้ำไปถึง 2000 ครั้ง เพื่อเช็คว่าโค้ดที่อยู่ในระบบของเราทั้งหมดอันไหนเปิดใช้แล้วบ้าง</p><p>ผมเคยลองเช็คโค้ด แบบฮาร์ดคอร์แบบนี้ กับโค้ดจำนวน 1000 โค้ด พบว่ามันโคตรจะกินเวลาและเปลืองพลังชีวิตมาก ที่จะต้องมานั้งก๊อปโค้ด วางในช่องแลกโค้ดแล้วกดเช็ค แล้วก็บันทึกว่าอันไหนใช้แล้วอันไหนยังไม่ได้เปิดใช้ ตอนนั้นถ้าจำไม่ผิดก็นั่งทำไปเกือบๆ 6 ชั่วโมง</p><blockquote>ก่อนหน้านั้นพยายามหา API หรือ ช่องทางที่ช่วยในการเช็คที่มันสะดวก แม้กระทั่งลองดักรีเควสตามประสา Dev อ่อนหัด ดักเอา header กับ parameter ไปแก้ๆแล้วลองส่งซ้ำด้วย เครื่องมือที่ไว้ส่ง GET/POST request ซึ่งก็ไม่ได้ผล เลยต้องยอมนั่งทำแบบฮาร์ดคอ ทั้งหมด 1000 โค้ดไปจนหมด</blockquote><p>งานนี้มันน่าเบื่อมากจนเป็นงานที่ไม่อยากคิดจะทำอีกเลย แต่ถ้าต้องทำ คงจะไม่ทำแบบเดิมแน่นอน มันเสียเวลา</p><h4>ตัวช่วยที่ใช้ในการเช็ค Promotion code ให้ชีวิตง่ายขึ้น</h4><p>สิ่งที่ช่วยมาแก้ปัญหา ของปัญหานี้ก็คือโปรแกรมชื่อ Burp suite ที่จะช่วยทำหน้าที่เช็คแทนให้เราแบบอัตโนมัติ โปรแกรมนี้จัดอยู่ในพวก Hacking tool สามารถใช้งานได้ฟรี ส่วนใหญ่คนจะเอาไปใช้งานในสายงาน ทดสอบความปลอดภัยของระบบ แต่ว่าเราจะเอาไปใช้อีกแบบ</p><h4>รายการโปรแกรมที่ต้องใช้ก็มี</h4><ul><li>FireFox</li><li>Burp suite (เวอร์ชั่นฟรี ก็ใช้ได้)</li></ul><p>สองอย่างนี้ก็น่าจะพอ</p><h4>เริ่มต้นปฏิบัติการได้….</h4><p>โดยขั้นแรกเราต้องโหลด Promotion code ของแอพเราลงมาก่อน สามารถเข้าไปโหลดจาก Google play store ในตอนที่เรากดสร้าง Code มา ซึ่งเราจะได้มาเป็นไฟล์ .csv สามารถเปิดดูกับ MS excel ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czlfp6wiYK4Qd7ej9Ggi3w.png" /><figcaption>กดที่ Download เราก็จะได้โค้ดทั้งหมดมาแล้ว</figcaption></figure><p>ต่อมาทำการเซ็ตโปรแกรม เริ่มต้นที่ Firefox ก่อน</p><p>สำหรับการใช้งานครั้งแรกให้ทำการ add Burp’s CA certificate ให้กับ Firefox ก่อน ดูวิธีทำได้ที่</p><p><a href="https://support.portswigger.net/customer/portal/articles/1783087-installing-burp-s-ca-certificate-in-firefox">https://support.portswigger.net/customer/portal/articles/1783087-installing-burp-s-ca-certificate-in-firefox</a></p><p>หลังจากทำตามลิ้งเสร็จแล้ว ก็ไปตั้งค่าให้มันวิ่งผ่าน proxy โดยไปที่ Option &gt; advanced &gt; network &gt;settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*827YrJfNDuiLRwYDuLqkHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BfWJPtXttaAq_57IXqoSeQ.png" /></figure><p>แล้วก็ตั้งค่าให้มันวิ่งผ่านตาม Proxy ตามรูป</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*ke_fgTWwaHuJAvjwhThBiQ.png" /></figure><p>หลังจากนั้นก็เข้าหน้าเว็ป Google play แล้วก็เปิดหน้าต่างสำหรับ Redeem code โดยยังไม่ต้องทำอะไรทั้งสิ้น</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-VgWIk3ahLOw3i45vhKrBg.png" /></figure><p>ต่อมาเปิด Burp suite แล้วก็ไปที่ Tap proxy เพื่อเริ่มต้นการดัก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2iUrQ0PcC531fS63G3157A.png" /></figure><p>ขั้นตอนต่อไปก็คือเปิด intercept is on ตั้งไว้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sNVMzv_FKc3AWJB43i-7VA.png" /></figure><p>หลังจากนั้น กลับไปที่firefox แล้วก็ใส่โค้ดลงไปเช็ค</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1icGSL2evPsFGEX7pBpYTA.png" /></figure><p>ใส่โค้ดเสร็จแล้วก็กด Redeem แล้วเราจะพบว่าหน้า Redeem มันยังไม่ไปไหน เพราะว่า Request นี้โดน Burp suite ดักไว้แล้ว</p><p>Burp suite ก็จะทำการดัก Request ไว้ โดยให้ดู Request ที่มันประกอบด้วย Promotion code ที่เราใส่ไปในหน้าเว็ป และ อีเมล์เรา แต่ถ้ามันเป็นแบบอื่นก็ให้กด Forward ไปเรื่อยๆก่อนจนกว่าจะเจอ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-Su5AMPLtuJSbauuAFC-w.png" /><figcaption>แบบนี้ยังไม่ใช่ กด Forward ปล่อยไปก่อน</figcaption></figure><p>เมื่อเจอแล้วว่า Request ที่ดักได้มาคือ Request ที่ Firefox ส่งโค้ดไปเช็ค แบบในภาพ คือมี parameter ชื่อ code กับ email แสดงว่าอันนี้แหละใช่แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BiKLq9EwkJI81rjNBzdhRA.png" /><figcaption>เจอแบบนี้ ถือว่าใช่เลย อันนี้แหละ</figcaption></figure><p>ให้ทำการคลิกขวาแล้วส่งไปให้ intruder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*7m7uuYsTDFOeS4HPnH-33w.png" /></figure><p>เมือ่กดแล้ว Tab intruder ก็จะขึ้นเป็นสีส้ม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*966pSsQHb4z4yNqZ4dFsiQ.png" /></figure><p>ใน Tab intruder เราจะเห็น Tab ย่อยทั้งหมด 4 อัน ซึ่งเราต้องเข้าไปจัดการเกือบทุก Tab แน่นอน แต่เริ่มจัดการทีละ Tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ixkaWES94oNQp3_xr59aqA.png" /></figure><p>อันดับแรก เลือก Tab Position ก่อน เมื่อกดเข้าไปก็จะเห็น Response ของหน้าที่เราดักมาในตอนแรก พร้อมกับไฮไลท์สีส้มเกือบเต็มหน้า จุดที่มันไฮไลท์ก็คือ ค่าของ Parameter ที่สามารถทำการเปลี่ยนแปลงได้เวลาเราทำการยิง Request สำหรับเช็ค</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SqLQCa9dVdEvucF7lMO4SQ.png" /></figure><p>แต่ว่าเราจะไม่เปลี่ยนทั้งหมด โดยเป้าหมายของเราก็คือเปลี่ยน Promotion code เท่านั้น วิธีก็คือ กด clear ด้านซ้ายก่อน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_DkkMO7Kd1n_pRErhXmBOQ.png" /></figure><p>แล้วไฮไลท์สีส้มก็จะหายไป หลังจากนั้นก็ไปไฮไลท์ที่โค้ดที่เราจะเปลี่ยนให้เป็นสีส้ม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mRY1YH0W-Pngs2W5IRzbQ.png" /></figure><p>แล้วก็กด add ที่ด้านซ้ายมือ แล้วโปรแกรมก็จะทำการ เพิ่ม § เข้าไปด้านหน้าและหลังโค้ด เพื่อเป็นการกำหนดจุดที่จะทำการเปลี่ยนค่า</p><p>ถือว่าเสร็จสิ้นในTab นี้แล้ว</p><p>ต่อไปก็คือ Tab Payload โดยเลือก payload type เป็นแบบ Simple list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*58SgaZPHDkZxwsX36qc-bw.png" /></figure><p>หลังจากนั้น เปิดไฟล์ .CSV ที่เก็บโค้ด Promotion ขึ้นมา แล้วก็ลากครอบแถวของโค้ดทั้งหมดทุกอัน แล้วก็ Crtl+C ก๊อปปี้เก็บไว้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*_vsc2s1eKhSpcgd4n8p5GA.png" /><figcaption>ก๊อปปี้Promotion code ทั้งหมด</figcaption></figure><p>กลับมาที่ Burp suite หน้าเดิม ในหัวข้อ payload options ให้กดปุ่ม Paste เพื่อวางโค้ดที่เราก้อปปี้มา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*wBtJGPkrv-sfxoXE-eKPsg.png" /></figure><p>หลังจากกด Paste แล้ว ในช่องข้างๆก็จะขึ้นโค้ดทั้งหมดที่เราก้อปมา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*MYDaIPHnLwTNRb7wrLFIlA.png" /></figure><p>ถือว่าเสร็จการตั้งค่าหน้านี้ ซึ่งเราสามารถกดสั่งให้ Burp suite ทำการ attack เพื่อเช็ค Promo code ได้เลย แต่ว่า เพื่อความสะดวกในการแยกว่าโค้ดอันไหนถูกใช้ไปแล้ว อันไหนยังใช้ได้ เราจึงควรทำการสั่งให้ Burp suite นั้นทำการแยก Respond ที่ได้มา แล้วนำไปแสดงในตาราง โดยการไปที่ Tap option</p><p>เลื่อนลงมาที่หัวข้อ Grep — Extract แล้วก็กด Add</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*II7_ZugM4Dlt7649FPiGBw.png" /></figure><p>โปรแกรมก็จะเปิดหน้าต่างอีกอันขึ้นมา ให้เรากดปุ่ม Fetch response เพื่อดึงตัวอย่าง response ขึ้นมา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*8H14ft982VJGKX4H3KqeCQ.png" /></figure><p>เมื่อตัวอย่าง response ขึ้นมาแล้ว เราก็ไฮไลท์ในส่วนผลลัพท์ที่ต้องการแยก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*iWk1Tv97BJRMKGfKSEN5MQ.png" /></figure><p>ซึ่งในในการส่ง Promo code ไปเช็ค เราจะได้คำอธิบายว่าโค้ดถูกใช้ไปหรือยัง ซึ่งในรูปมันจะแสดงประโยคว่า “The item you are ….. already in your library” แปลว่า โค้ดยังไม่ถูกใช้ เพราะว่าอีเมล์ที่ผมเอามาเช็คซื้อแอพนี้ไปแล้ว มันเลยขึ้นแบบนี้ ถ้ายังไม่ซื้อมันก็จะขึ้นอีกอย่าง (ซึ่งจะเห็นเป็น response ขนาดเกือบๆ 10,000 แสดงออกมาตอนทำงาน)</p><p>แต่ถ้าแอพถูกใช้ไปแล้ว มันจะขึ้นว่า “ The code you entered has already been redeemed by someone else. …….”</p><p>เอาเป็นว่าเราจะทำการไฮไลท์ในจุดนี้ เพื่อไว้แยก Response</p><p>เมื่อไฮไลท์แล้วก็กดปุ่ม OK ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*AnWA85ZwTeKwaA-CZ0OA_Q.png" /></figure><p>อันที่จริง ขั้นตอนใน Tab options นี้ไม่ได้จำเป็น เราสามารถกดสั่งให้มันทำงานได้ตั้งแต่เราตั้งค่า Tab payloads แล้ว</p><p>ถ้าใครจะไม่ทำส่วนนี้เราก็ยังสามารถแยกผลลัพท์จาก respone ได้อยู่เหมือนกัน</p><p>เอาหละ ตอนนี้ ทุกอย่างพร้อมแล้ว เราสามารถกด Start Attack ได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*b7I0PyjfqM-Y2saaIkyqhQ.png" /></figure><p>เมื่อกดไปแล้ว ถ้าใครใช้ของฟรีก็จะมี Pop up ขึ้นมาเตือนนิดหน่อยกดข้ามไปได้เลย ไม่มีอะไรต้องกังวล</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*O2U49ZPYsmTyNODoW6H1Jg.png" /></figure><p>แล้วBurp suiteก็จะเริ่มทำการส่ง request พร้อม Promo code ของเราไปเช็ค</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*Q9sgGoZ3WWTNuJt0tWqPbA.png" /></figure><p>สำหรับใครที่ไปตั้งค่าแยก Response ไว้ใน Tab Options เราก็จะเห็นผลลัพท์จาก Response แยกไปตามโค้ดเลยว่าอันไหนยังไม่ได้ใช้ อันไหนใช้แล้ว</p><p>แต่สำหรับคนที่ไม่ได้ตั้งค่าใน tab options ก็ให้ดูผลจาก length ของ response ที่ตอบกลับมา ถ้าจะเช็คว่า responseที่มี length ขนาดนั้นตอบกลับมาเป็นอะไรก็ให้เปิดไปดูที่ tab response</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*5vexbEkoWpRdzkE6H6K4iA.png" /></figure><p>ซึ่งจากรูปจะเห็นได้ว่า length ขนาด 2292 นั้นตอบกลับมาเป็น “The code you entered has already been redeemed by someone else” แปลว่า โค้ด โดนใช้ไปแล้ว</p><p>ซึ่งก็หมายความว่า length ที่ขนาด 2292 ทั้งหมดนั้นเป็นคือโค้ดที่ถูกใช้ไปแล้ว ส่วน length อีกขนาดก็หมายความว่าเป็น response ของโค้ดที่ยังไม่ถูกเปิดใช้</p><p>แต่ว่าไม่ได้หมายความว่าระหว่างการ Attack รอบนั้นเราจะเจอ length ของ response แค่ 2 ขนาด บางทีขนาดก็อาจจะเปลี่ยนไป ทำให้เกิด length จำนวน 4 ชุด หรือมากกว่านั้นซึ่งก็ต้องมาดูอีกทีว่า length นั้น เป็น response ของอะไร</p><p>การตั้งค่าใน Tab options จึงจะช่วยให้เราไม่ต้องมาคำนึงถึงจุดๆนี้ ดูที่ท้ายแถวของ โค้ด ได้เลยว่าอันไหนยังใช้ได้ อันไหนถูกใช้ไปแล้ว</p><p>ระหว่างมันทำงาน เราก็แค่รอ ซึ่งเราเอาเวลาไปทำอย่างอื่นแทนก็ได้ เมื่อเทียบกับต้องมานั่งกดก้อปปี้ไปมาเช็คเองที่จะเสียเวลาไปเป็นชั่วโมงๆ ไปไหนไม่ได้ เมื่อยด้วย</p><p>และเมื่อมันทำงานไปได้ซักพักแล้ว มันจะเริ่มส่ง request ได้ช้าลง ซึ่งถือว่าปกติ รอไปยาวๆ น่าจะเป็นเพราะใช้เวอร์ชั่นฟรี</p><p>เมื่อมันทำงานเสร็จแล้ว เราก็แค่ ก้อปปี้ผล Request จากในตารางไปแปะไว้ใน excel ก็ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*V15RREahGKwAG0Nk3HDvgQ.png" /></figure><p>โดยมันเหมือนจะมีข้อจำกัดอยู่หน่อยนึงตรงที่ ตารางที่เราก๊อปปี้จะเอาไปแปะลงใน ไฟล์ .xlsx ตรงๆไม่ได้ ต้องไปวางในไฟล์ .csv ซึ่งเราก็แค่เอาไปแปะคือในไฟล์ .csv ที่เราเอาโค้ดมา ก็เท่านั้น (ไฟล์ที่ได้จากตอนโหลด Promotion code จาก play store)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjgsWgrnODAbBp9E9MnfKw.png" /></figure><p><strong><em>คำแนะนำพิเศษ</em></strong></p><p>หลังจากเราวางผลลัพท์จากตารางลงใน excel แล้ว เราก็ทำการ ตั้ง filter ด้วยฟังก์ชั่นของ excel โดยแยกตาม length ก็ได้ ดูว่า ขนาด length อันไหนคือ ขนาดของ response ของโค้ดที่ยังไม่ได้ใช้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opmVt07NlNDFkCW9alMQxA.png" /></figure><p>จากตัวอย่างในรูป โค้ดที่ยังไม่ถูกใช้ มีขนาด 2179 ผมก็แค่ สั่งให้กรองข้อมูลให้แสดงเฉพาะ 2179 แล้วเราก็จะได้ โค้ดทั้งหมดที่ยังไม่ถูกใช้งาน แล้วเราก็ทำการเซฟไฟล์</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*xesqsd6Da0X2nLxbhGuwXQ.png" /></figure><p>โค้ดที่ได้ก็เอาไปแจกต่อได้ โดยไม่ต้องกลัวว่า โค้ดนั้นจะถูกใช้ไปแล้ว แจกไปแล้ว ถ้าเราจะมาเช็คอีกที ก็แค่ทำตามขั้นตอนข้างบนอีกรอบ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*mRYKnJMxg9vB_xZY1u25QQ.png" /></figure><p>จนเมื่อโค้ดถูกใช้หมด ก็น่าจะถือว่าบรรลุผลเหนืออื่นใดแล้ว</p><p>ขอให้สนุกกับการสร้างแอพครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d534a3f959f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/%E0%B9%80%E0%B8%8A%E0%B9%87%E0%B8%84-promotion-code-%E0%B8%82%E0%B8%AD%E0%B8%87-app-%E0%B9%80%E0%B8%A3%E0%B8%B2-4d534a3f959f">เช็คการเปิดใช้งาน Promotion code ของ App เราอย่างไรให้เร็วและมีประสิทธิภาพ ด้วย Burp suite</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My setup desk : แท่นวางคีย์บอร์ดอันที่สอง]]></title>
            <link>https://medium.com/ammarptn/my-setup-desk-%E0%B9%81%E0%B8%97%E0%B9%88%E0%B8%99%E0%B8%A7%E0%B8%B2%E0%B8%87%E0%B8%84%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94%E0%B8%AD%E0%B8%B1%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%AA%E0%B8%AD%E0%B8%87-3f32dae1af4a?source=rss-817b8a5615a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f32dae1af4a</guid>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[table]]></category>
            <category><![CDATA[slider]]></category>
            <dc:creator><![CDATA[Ammarptn]]></dc:creator>
            <pubDate>Fri, 03 Feb 2017 00:02:30 GMT</pubDate>
            <atom:updated>2017-02-03T00:02:30.488Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iaYV4AGO3Sd-OJAVVOC3Tw.jpeg" /></figure><p>หลังจากโชว์แท่นวางอันแรกไปแล้วใน <a href="https://ammar.lanui.online/my-setup-desk-%E0%B9%81%E0%B8%97%E0%B9%88%E0%B8%99%E0%B8%A7%E0%B8%B2%E0%B8%87%E0%B8%84%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94-a4ef9fde077f">My setup desk : แท่นวางคีย์บอร์ด</a> ถ้ายังไม่อ่าน ก็กดเข้าไปดูได้</p><p>ที่วางอันแรกมันก็ทำหน้าที่ของมันได้ดีเยี่ยม แต่ว่า ผมไม่ได้มีคีย์บอร์ดแค่อันเดียว ในเวลาทำงาน ไม่ว่าจะเขียนโค้ดหรือ พิมพ์งานคีย์บอร์ดอันที่สองนั้นจะสร้างความสะดวกและทำให้งานนั้นเดินไปได้ไวมาก โดยผมยกหน้าที่คีย์บอร์ดอันแรกไว้สำหรับพิมพ์ แล้วคีย์บอร์ดที่สองหล่ะ มันก็มีปุ่มไว้พิมพ์เหมือนกัน แล้วมันจะทำอะไรได้นอกจากไว้พิมพ์ ?</p><p>คีย์บอร์ดอันนี้ ทำหน้าที่ ไว้สำหรับกดคีย์ลัด หรือที่เราเรียกกันว่า shortcut หลายๆคนงงแน่นอน ว่าอะไรคือคีย์ลัด แล้วทำไมกดบนคีย์บอร์ดอันแรกไม่ได้หรอ?</p><p>คีย์ลัดก็คือการที่เรากดปุ่มสองปุ่มขึ้นไปเพื่อให้มันทำงานตามที่โปรแกรมมันรองรับ เช่น กด Ctrl+C คือการ Copy แล้ว กด Crtl + V คือการ Paste</p><p>พวกนี้แหละ ที่เราเรียกว่าคีย์ลัด ซึ่งถ้าใช้ทั่วไปก็ไม่มีปัญหาหรอก แต่ว่าเวลาเขียนแอพ เขียนโปรแกรม มันจะมีคีย์ลัดที่จำเป็นต้องกดใช้บ่อยๆ หลายๆแบบ แล้วก็อาจจะกดยากด้วย เช่นกด สามปุ่มพร้อมกัน แถมปุ่มก็อยู่ห่างกันมาก เวลาใช้งานจริงๆ มันก็ไม่สะดวก</p><p>นี้แหละคือเหตุผลที่ผมแต่งตั้งคีย์บอร์ดอันที่สองขึ้นมา เพื่อทำหน้าที่นี้ คือไปกำหนดปุ่มบนคีย์บอร์ดอันที่สองให้มันทำงานเป็นคีย์ลัดแทน โดยคีย์บอร์ดที่เอามาใช้มันสามารถตั้งให้ปุ่มบนคีย์บอร์ดนั้นๆ แปลงเป็นปุ่มอะไรก็ได้ จำลองการกดหลายๆปุ่มก็ได้ เช่น กำหนดปุ่ม S ให้เป็น Ctrl + Shit + S และเมื่อกำหนดไปแล้ว เมื่อเรากดปุ่ม S แค่ปุ่มเดียวบนคีย์บอร์ดอันที่สอง มันก็จะกลายเป็นการจำลอง Crtl + Shift + S ไปในทันที โดยที่มันจะไม่ไปตีกันกับคีย์บอร์ดอันแรก ถ้าเรากดปุ่ม S บนคีย์บอร์ดอันแรก มันก็ยังจะเป็น S</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*PiO7hlqlx_Ibv6gfM5yu6w.png" /><figcaption>ตัวอย่างโปรแกรมตั้งมาโครให้กับปุ่ม</figcaption></figure><p>เกรินมาซะยาว มาเข้าประเด็นกัน</p><p>ปัญหาคือ ไม่มีที่จะวางคีย์บอร์ดอันที่สองแล้ว T — T เพราะพื้นที่โต๊ะเต็ม แถมคีย์บอร์ดมันก็กินพื้นที่ไม่ใช่เล่น ย้ายอะไรออกก็ไม่ได้ เลยต้องหาทางออก</p><p>โต๊ะที่ใช้ทำงานอยู่คือมันก็เป็นโต๊ะไว้ทำงานนั้นแหละ มีสองชั้น แต่ไม่ได้ถูกสร้างมาเพื่อเป็นโต๊ะคอมมั้งนะผมว่า แบบเนี้ย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*GeXp2vVNBWEDJ69g2TDndw.png" /></figure><p>จากในรูป มันก็ดูเหมือนมีพื้นที่เยอะ แต่ว่าผมก็เอาอย่างอื่นไปตั้งหมดแล้ว แถมถ้าเอาไปตั้งลึกๆ ซ้อนกันก็ใช้งานไม่สะดวกอีก</p><p>ซึ่งถ้าเป็นโต๊ะคอมที่ไว้ใช้เล่นคอมจริงๆ มันมักจะมีสิ่งที่เรียกว่า ที่วางคีย์บอร์ด ที่มันสไลด์เก็บเข้าไปได้ แบบภาพข้างล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Iik2P48tFd2B4NccQOzNAA.png" /><figcaption>ที่วางคีย์บอร์ดแบบเลื่อนได้</figcaption></figure><p>ไอที่วางคีย์บอร์ดเนี่ยมันก็ไม่ใช่อะไรใหม่มากหรอก มันมีอยู่ทั่วๆไป แต่ว่า</p><p>โต๊ะผมไม่มี!!! แต่ผมอยากได้</p><p>ถ้าจะไปซื้อโต๊ะใหม่ที่มันมีมันก็ไม่ใช่ทางออก เลยต้องสร้างเอง</p><p>ใช่แล้ว ผมจะเอาโต๊ะเก่ามาใส่ที่วางคีย์บอร์ดแบบสไลด์เก็บได้ เมื่อจะใช้งานก็เลื่อนออกมา ไม่ใช้ก็เลื่อนเก็บเข้าไป ไม่เกะกะ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*frmXf2DrafPB_WlxBvH_WQ.gif" /><figcaption>ภาพจำลองโต๊ะที่จะลองใส่ตัวเลื่อนเก็บคีย์บอร์ด</figcaption></figure><p>เมื่อได้ไอเดียแล้ว ก็ต้องทำครับ อย่าปล่อยให้มันหายไป อย่างแรกคือ ไปหาซื้ออุปกรณ์ครับ แต่ว่าไม่ใช่ช่างทำโต๊ะ ไม่เคยทำมาก่อน เลยไม่รุ้ว่าต้องเตรียมอะไรบ้าง เลยไปหาอุปกรณ์เอาดาบหน้าที่ร้าน</p><p>เดินวนๆในร้านได้ซักพักก็พอที่จะมองออกว่าต้องซื้ออะไรมาทำยังไงบ้าง</p><p>ตัวแรกครับคือ <strong>L</strong>-<strong>Bracket </strong>(ไม่รู้ว่าภาษาไทยเรียกอะไร)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*hydiqI937J-PG4gHMYkayw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*Ya6WHGbDySz8r37D0vzJTg.jpeg" /></figure><p>ซึ่งมันเอาไว้ยึดมุมไม้ให้มีความแข็งแรง แต่ว่าผมจะเอามันมาทำเป็นตัวยึดระหว่างไม้กระดานที่เอาไว้เลื่อนกับไม้ของโต๊ะ เพราะด้านข้างของโต๊ะผม มันไม่มีอะไรให้ยึดได้เลย เป็นแท่งเหล็กเพียวๆ โดยเลือกขนาดให้ยาวกว่าความสูงของคีย์บอร์ด ยาวเผื่อไว้ก็ยิ่งดี ผมซื้อมา 4 ตัว เพราะต้องยึด 4 มุม</p><p>ซึ่งจะเอามาทำแบบนี้ๆ ตามรูปข้างล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*co9hOk12V9i1as47XByUSw.png" /></figure><p>แล้วตัวต่อไปที่สำคัญที่สุดก็คือ รางเลื่อนแบบเนี่ย!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*eN_Y_WRj-owNtz9OBaHkpg.jpeg" /></figure><p>ไม่คิดเหมือนกันว่ามันจะมีขายแยก ทำให้ทุกอย่างง่าย ขึ้นไปเลย</p><p>ต่อไปก็ไปซื้อไม้กระดานมาอันนึง เลือกสีที่ชอบ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*Bcur8UjCErupqObMnlDHxA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*9x_yM1TDlYO6_kg24Hbbmg.jpeg" /></figure><p>แล้วก็สกรูและน็อตเอาไว้ยึด</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FesEcLsYCCXGGhbe5cKbEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*KY3R1bqNxqc_wwLiuPixog.jpeg" /></figure><p>ได้อุปกรณ์มาทั้งหมดแล้วก็ แบกกลับห้อง เตรียมติดตั้ง</p><p>อย่างแรกเลยที่ทำก็คือวัดขนาด ถ้าซื้อกระดานมาใหญ่กว่าโต๊ะก็ต้องเลื่อยเอา แต่ของผม มันพอดี แล้วก็ประมาณระยะเอาว่าจะให้มันอยู่ตรงไหน ไม่มั่นใจก็ลากเส้นวัดเอา ตรงนี้ต้องเปะ กว้างให้พอดีกับแผ่นกระดาน อย่าให้พลาด เพราะถ้าพลาด ก็จะทำให้ใส่กระดานเข้าไปไม่ได้</p><p>ต่อไปก็ติดตั้ง <strong>L-Bracket </strong>เข้าไปกับโต๊ะตามที่วางแผนไว้ ผมใส่สกรูยึดเอา ไม่ใช้ตะปูเพราะคิดว่ามันน่าจะแข็งแรงกว่า ที่ผมทำก็คือเจาะรูนำไปก่อนแล้วก็ เอาสกรูขันลงไปเลย ทำให้ครบทั้ง 4 ด้าน แล้วก็ติดรางสไลด์เข้าไปกับ <strong>L-Bracket </strong>ซึ่งตรงนี้มันใช้สกรูยึดไม่ได้เพราะอีกด้านไม่มีอะไรให้ยึด ถ้ามีน็อตก็ใช้น็อต แต่ผมไม่มี เลย ใช้เคเบิ้ลไทร์มัดเอา เพราะตอนนี้ไม่มีน็อตเหลือ ขี้เกียจออกไปซื้อแล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cIsfNdMlpQKDAr4mi4p_2g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*diKgciwbvW_Ss6rqh8NnOg.jpeg" /><figcaption>ติดตั้ง <strong>L-Bracket </strong>เข้าไปกับโต๊ะ แล้วใช้เคเบิ้ลไทร์ยึดเอา</figcaption></figure><p>ต่อไปก็คือติดรางสไลด์อีกชุดกับไม้กระดาน</p><p>วิธีที่ทำคือเจาะรูที่ด้านข้างของไม้กระดาน แล้วก็ใช้สกรูยึดเอา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJvTlt8EHon8zFm4UWAXrg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bN96_JP2xyXz4NwIyX2wjA.jpeg" /></figure><p>แล้วก็ใส่เข้าไปในราง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTHSfdEXsckY7IrV7l-g_A.jpeg" /></figure><p>เรียบร้อยแล้ว เราก็จะได้ ที่วางคีย์บอร์ดแบบสไลด์ พร้อมใช้งาน</p><p>วางคีย์บอร์ดลงไป</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1MbQxOOaixeFIeCLb471w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iaYV4AGO3Sd-OJAVVOC3Tw.jpeg" /><figcaption>คีย์บอร์ดแบบ Full size กับ แบบ 60% วางเที่ยบกัน</figcaption></figure><p>ถ้าเป็นคีย์บอร์ดแบบ 60% อันเล็กๆ ก็จะยังพอมีที่เอาไว้ให้ตั้งเมาส์ แต่ถ้าเป็นแบบ Full size มันก็จะกินที่ทั้งหมด ก็แล้วแต่จะเลือกวาง</p><p>ครบสูตร คีย์บอร์ดสองชั้นพร้อมใช้งาน</p><p>เมื่อไม่ใช้งานก็เลื่อนเข้าไปซ่อนเก็บได้ ไม่เกะกะ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MJ8a1SHUWqgqKaT3i9b1Gw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxriSLPSqNc1mcX2yvBgYQ.jpeg" /></figure><p>จบแล้วสำหรับการ DIY รอบนี้</p><p>ปล. ครั้งแรกที่ลงทุนหัดทำโมเดลโต๊ะ เพื่อเอารูปมาประกอบบทความเลยนะเนี่ย</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f32dae1af4a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ammarptn/my-setup-desk-%E0%B9%81%E0%B8%97%E0%B9%88%E0%B8%99%E0%B8%A7%E0%B8%B2%E0%B8%87%E0%B8%84%E0%B8%B5%E0%B8%A2%E0%B9%8C%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94%E0%B8%AD%E0%B8%B1%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%AA%E0%B8%AD%E0%B8%87-3f32dae1af4a">My setup desk : แท่นวางคีย์บอร์ดอันที่สอง</a> was originally published in <a href="https://medium.com/ammarptn">Ammarptn</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>