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
Visual Studio 2013 Express is ok so far
I am running out of licenses for Visual Studio Professional. Solution 1 is asking for more budget this year in IT. Another option is using Express version. I know this version doesn't come with automated testing and class diagrams, those sorts of developers' support tools.However, we don't use those tools a lot. We just build MVC website. So far, Visual Studio 2013 Express is ok for us, it supports NuGet, MVC and EF. I felt that is even faster then the Professional version.
Id in onItemClick is not your Object Id
public abstract void onItemClick (AdapterView<?> parent, View view, int position, long id) in AdapterView
Last parameter calls id, but that will be row id, not the data object id in item.
You should use position and getItemAtPosition to get the data object in item you clicked. Then you can access id.
E.g.
Code
long noteId = ((Note)mListView.getItemAtPosition(position)).getId(); |