Sign in

Catatan error harian seorang programmer

To get the SHA1 for ClientID for Sign In with Google+ and more actions:

General Form:

keytool -list -v -keystore <your_keystore_full_path> -alias <your_alias_name>

For Debug, replace with your debug.keystore path, for Example :

keytool -list -v -keystore C:\Users\DAVID\.android\debug.keystore -alias androiddebugkey

Password: android

For Release, replace with your keystore path and alias password, for Example :

keytool -list -v -keystore C:\ProjectsData\keystore\my-release-key.keystore -alias alias_name

Password: Your alias password.


According to Android SDK docs you can use the following command depending on the sdkmanager location: Docs on --licenses option seems to be missing though.

yes | sdkmanager --licenses

GNU/Linux Distributions:

yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses

macOS:

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

Windows:

%ANDROID_HOME%/tools/bin/sdkmanager --licenses

Flutter:

> flutter doctor --android-licenses

flutter pub get
flutter pub run flutter_launcher_icons:main

1. MEMBUAT FLUTTER PROJECT DENGAN CUSTOM PACKAGENAME

flutter create — org com.package_name application_name


flutter

Berikut adalah cara build apk release dari aplikasi android yang dibuat dengan menggunakan flutter.

1. Android Manifest

  • Buka android/app/src/AndroidManifest.xml
  • Ubah nama package, android:label

2. Ubah icon
Dijelaskan di artikel : Klik Disini

3. Buat Keystore
Di dalam cmd folder project tulis perintah :
keytool -genkey -v -keystore keystore.jks …


If you are using Glide v4 then you have to use RequestOptions for including the more options you want, for example centerCrop(), placeholder(), error(), priority() , diskCacheStrategy().

So after using RequestOptions your Glide would look like this

RequestOptions options = new RequestOptions().centerCrop().placeholder(R.drawable.default_avatar)
 .error(R.drawable.default_avatar)
 .diskCacheStrategy(DiskCacheStrategy.ALL)
 .priority(Priority.HIGH);

Glide.with(mContext).load(imgUrl)
 .apply(options)
 .into(picThumbnail);

Now you can show error image and placeholder set the disk cache etc.

GlideApp is also a part of Glide v4. It is used to provide more than one Transformation in Glide v4, using the transforms() method:

GlideApp.with(mContext)
.load(imgUrl)
.transforms(new CenterCrop(), new RoundedCorners(20))
.into(target);

error() and placeholder() using GlideApp

GlideApp.with(mContext)
.load(imageUrl)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.priority(Priority.HIGH)
.into(offerImage);

source:


Ah ini hanyalah keisengan saya saja untuk mempelajari hal — hal yang belum saya mengerti.

Dibawah adalah coding sederhana CRUD menggunakan Python dengan Flask Framework.

Semoga bisa menjadi penerang dalam kegelapan.

Saya test coding ini menggunakan postman dan database yang digunakan adalah MySQL.

PYTHON

import os
from pprint import pprint

from flask import…


Saya pernah mendapatkan kasus dimana ketika saya ingin menampilkan data dari database menjadi sebuah json. Tetapi, data tersebut tidak tampil saat di encode menjadi json. (json_encode).

Saya pikir ada kesalahan pada query-nya, ternyata query-nya sehat-sehat saja tuh. setelah dilakukan var_dump() datanya muncul berupa array. Tetapi saat masuk ke line json_encode dia hilang, blank tidak ada response apa-apa.

Setelah saya googling, saya menemukan solusi untuk menambahkan mysqli_set_charset pada file php-nya.

Berikut sedikit pencerahan dari om google mengenai mysqli_set_chartset().

The mysqli_set_charset() function sets the default character set (specified by the charsetparameter) to be used when sending data from and to the database server represented by the link parameter.

berikut contoh coding sebagai pencerahan.

<?php
$con=mysqli_connect(“localhost”,”my_user”,”my_password”,”my_db”);
// Check connection
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: “ . mysqli_connect_error();
}

// Change character set to utf8
mysqli_set_charset($con,”utf8");

mysqli_close($con);
?>


Terkadang kalau kita melihat URL codeigniter, pasti selalu di awali dengan http://namadomain.com/index.php/controller.

rasanya ada index.php/ di situ sangat tidak indah di pandang. Terus bagaimana cara menghilangkannya?

Salah satu tipsnya yaitu menggunakan .htaccess.

Silahkan langsung comot aja coding berikut, save ke file .htaccess dan simpan di folder /root kamu.

Selamat mencoba.

<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?baseurl=$1 [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

Bugs Daily Programmer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store