Category: Quick Tips
-
MySQL replication: How to recover from “Event too small corruption” or “Slave SQL: Relay log read failure”
The basic principle is, just restart where the slave left off. The problem arises if a binary log, on the slave side, remains corrupt. The recovery is relatively simple, just follow the recipe: STOP SLAVE SHOW SLAVE STATUS Note down ‘Relay_Master_Log_File’ and ‘Exec_Master_Log_Pos’ entries. RESET SLAVE CHANGE MASTER TO ….. (use MASTER_LOG_FILE=relay_master_log_file and MASTER_LOG_POS=exec_master_log_pos from…
-
tip: Volley comm library for android, available via Gradle
Previously, in order to use Volley, the only way was to add the “jar” file to the project – not anymore – official volley is now available, just change the app.gradle file:
-
Quicky check if Data connection is available (Android SDK)
Just use the following method: public boolean isOnline() { boolean status=false; try{ ConnectivityManager cm = (ConnectivityManager) getActivity() .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); status=netInfo.isConnected(); }catch(Exception e){ e.printStackTrace(); return false; } return status; }
-
Android Toasts (e.g. small notifications), how to use in Fragments
The syntax is very simple. The example below is invoked from inside a Fragment, so the first parameter (Context) is the activity that holds the fragment: Toast.makeText(getActivity(),R.string.asset_added_fav,Toast.LENGTH_SHORT).show(); The second parameter is the message, the third is the duration, Toast.makeText returns an instance of Toast, that we “.show()” immediately.
-
FTP file upload using CURL
The command is very very simple: just type curl -T localfile.ext ftp://username:[email protected]/remotedir/ If you want to use a different destination filename just add it at the end: curl -T localfile.ext ftp://username:[email protected]/remotedir/remotefile.zip