Posts

Showing posts from 2017

Git basic command

Repository Nơi lưu trữ program và file ở trong hệ thống quản lý Version Trên Git chia repository thành 2 loại là Local repository và Remote repository Local repository Repository đang thao tác hiện tại, trong trường hợp thao tác chủ yếu trên máy tính cá nhân hoặc server phát triển gọi là local repository Ngoài ra, có thể sao chép repository từ remote repository và xây dựng môi trường trên máy tính cá nhân hoặc server Remote repository Repository nằm ngoài, có thể thao tác thông qua local repository Có thể sử dụngg trong trường hợp nhiều người thao tác , public trên internet Working tree Nơi user edit, tạo file mới Index Nơi bảo trì trạng thái sau khi edit trên working tree là đối tượng tiếp theo trước khi commit lên repository Branch Dùng để phân nhánh và ghi chép lịch sử. Nhánh đã chia không bị ảnh hưởng của nhánh khác nên có thể cùng có nhiều thay đổi trong repository giống nhau Trên Git có 3 loại local branch, remote branch, remote tracking branch Lo...

Upload image in webview Android Xamarin

public class WebChromeClientIndigo : WebChromeClient     {         Action<IValueCallback, Java.Lang.String, Java.Lang.String> callback;         public WebChromeClientIndigo(Action<IValueCallback, Java.Lang.String, Java.Lang.String> callback)         {             this.callback = callback;         }         //For Android 4.1         [Java.Interop.Export]         public void openFileChooser(IValueCallback uploadMsg, Java.Lang.String acceptType, Java.Lang.String capture)         {             callback(uploadMsg, acceptType, capture);         }     } In Activity public class WebViewActivity : Activity     { WebViewClientIndigo webViewClient;         WebChromeClientIndigo...

debug chrome in android from desktop

Connect phone to desktop and go chrome type: chrome://inspect/#devices

Restart app after reboot android

Broadcast reciever, starts when the device gets starts. * Start your repeating alarm here. */ public class DeviceBootReceiver extends BroadcastReceiver { @Override public void onReceive ( Context context , Intent intent ) { if ( intent . getAction (). equals ( "android.intent.action.BOOT_COMPLETED" )) { /* Setting the alarm here */ Intent alarmIntent = new Intent ( context , AlarmReceiver . class ); PendingIntent pendingIntent = PendingIntent . getBroadcast ( context , 0 , alarmIntent , 0 ); AlarmManager manager = ( AlarmManager ) context . getSystemService ( Context . ALARM_SERVICE ); int interval = 8000 ; manager . setInexactRepeating ( AlarmManager . RTC_WAKEUP , System . currentTimeMillis (), interval , pendingIntent ); Toast . makeText ( context , "Alarm Set" , Toast . LENGTH_SHORT ). show (); ...

Remove credential of Github

git config --system --unset credential.helper git config --global --unset credential.helper

Remove all Vietnamese character javascript

function remove_unicode(str)  {     str= str.toLowerCase();     str= str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");     str= str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");     str= str.replace(/ì|í|ị|ỉ|ĩ/g,"i");     str= str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");     str= str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");     str= str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");     str= str.replace(/đ/g,"d");     str= str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g,"-");    str= str.replace(/-+-/g,"-"); //thay thế 2- thành 1-    str= str.replace(/^\-+|\-+$/g,"");     return str;   }