How to set whether display error in php
By the default, whether the php will display error message is controlled by php.ini. If you are using a shared host, you cannot change it. So, you have to add this line of code on the first line of your php file:
PHP
ini_set('display_errors','on'); |
That is to display the error message , To hide all error message, just use this:
PHP
ini_set('display_errors','off'); |
Quick Fix for Android Studio - Alt+Enter
This is the first keyboard shortcut you need to learn if you use Android Studio. This is ALT+Enter. It opens to Quick Fix Menu, which has the suggestions about fixing the errors in the current line of code.
Error: Specified key is not a valid size for this algorithm. (TripleDES)
I built a Cryptography application by using TripleDES. But I got an error:
System.Security.Cryptography.CryptographicException: Specified key is not a valid size for this algorithm.
The key I used was in an incorrect length, it should 16 bytes length.
For example:
Code
PasswordDeriveBytes pwd = new PasswordDeriveBytes("password", salt); | |
TripleDES alg = TripleDES.Create(); | |
| |
alg.Key = pwd.GetBytes(16); | |
alg.IV = new byte[alg.BlockSize / 8];; |
Like keyword in db.rawQuery with parameter
You can use "?" as the placeholder in sql for parameter in db.rawQuery in Android
For example
Code
String sql= "select Id , Name, Note from note | |
where Name = ?"; | |
Cursor c = db.rawQuery(sql, new String[] { name.toUpperCase() }); |
How about "Like" keyword with two "%".
You cannot do that :
Code
String sql= "select Id , Name, Note from note | |
where Name like %?%"; | |
Cursor c = db.rawQuery(sql, new String[] { name.toUpperCase() }); |
You have to do that like:
Code
String sql = "select from " + NoteTable.TABLE_NAME + " where upper(" + NoteTable.NoteColumns.NOTE + ") LIKE ? "; | |
Cursor c = db.rawQuery(sql, new String[] { "%"+name.toUpperCase() +"%" }); |
WhatsApp (web version)
I tried WhatsApp, Web version, that is very easy to use. Firstly, go to https://web.whatsapp.com/. Then open WhatsApp in my phone, click Menu->WhatsApp. Finally, Scanning QR code by using phone. Then it will works.
Now, I can send and receive messages in my computer. Using a bigger screen and a full-size keyboard, that is more comfortable to read and reply message. Also, you only need to drag and drop the files to the images into the message window, then the images will be sent out.
Only disadvantage is only working on Chrome


