sqlite-pcl vs sqlite-net xamarin component - sqlite

I have installed sqlite-pcl, but there is also component for Xamarin sqlite-net.
What is the main difference between those references? And which of them has better performance?
As I know pcl doesn't support relationships (foreign key), but sqlite-net does. So I use [Indexed] attribute for better performance, does it make seance?

They are both based on the same Sqlite.Net library but the PCL project is a fork which tries to improve on the previous project:
This is a fork of the original sqlite-net library
(https://github.com/praeclarum/sqlite-net), which aims to improve the
code quality by using modern technologies such as PCL (portable class
library).
The project will avoid the use of #if-based conditional code and use
platform-specific code injection instead.
I welcome pull requests, but keep in mind that this library is in
heavy use and all changes must be:
Backwards-compatible (don't change database defaults). Well tested
(please add unit tests).
Both don't support foreign keys.
Performance-wise the PCL project supposed to be better, but that is untested as far as I know.

Related

SQLite library for .net Core/Standard: MS EF or sqlite.org?

I'm having trouble getting a overview of the different SQLite libraries to be used with .Net Core and/or Standard.
It seems there are primarily two:
MS: Microsoft.EntityFrameworkCore.Sqlite
sqlite.org: System.Data.SQLite
Is the MS library completely independent of the sqlite.org's libraries? And if so, which one is recommended to use?
I prefer simplicity....it seems I just need two dll's if using sqlite.org.
There are two main SQLite packages for .NET Core/Standard. They are independent and use separate native binaries.
Microsoft.Data.Sqlite
System.Data.SQLite
The former is provided by Microsoft, the latter by SQLite.org. I prefer the Microsoft one but unless you're looking for specific functionality (SQLite.org's supports encryption, Microsoft's supports fts5, etc) either one will probably work fine. They both implement System.Data.Common and so the APIs are almost identical. SQLite.org's can load arbitrary extensions which Microsoft's cannot (though with the latest release it was looking like SQLite.org's couldn't load fts5 which I know worked with previous releases).
I would recommend using Entity Framework Core or another similar third-party database abstraction package unless you absolutely can't use modelling for some reason (EFCore still lets you run the occasional low level query if you need to). It's quicker to develop, and easier to maintain the code.
Microsoft.EntityFrameworkCore.Sqlite provides support for Sqlite in EFCore, using Microsoft.Data.Sqlite. So you would want to use that in this case. The internet says you can also use System.Data.SQLite but it looks like Microsoft.EntityFrameworkCore.Sqlite still tries to load the underlying native binary from Microsoft.Data.Sqlite for some purpose, though it does appear to use System.Data.SQLite for the actual database operations. Not sure exactly what's going on there.
Microsoft.EntityFrameworkCore.Sqlite is for Entity Framework Core ORM is more complete but heavier.
The System.Data.SQLite.Core can use with Dapper ORM SQLite and Dapper but I use the Microsoft.Data.Sqlite.Core with SQLitePCLRaw.bundle_e_sqlite3 and Dapper ORM, I think I had problems with System.Data.SQLite.Core.
Use without is hard and I not recommend.

How to generate SHA3-256 in .NET Core?

Is there an option to calculate SHA3-256 hashes in .NET Core? The goal is to recreate the isChecksumAddress util function in web3.js
No, there is no way of doing that now with pure dotnet core.
It's been on the watch list since it was announced. Since we don't implement cryptographic algorithms within .NET we're waiting on support from the underlying platforms (Windows CNG, Apple Security.framework, and OpenSSL).
See this issue.
But you might have a better luck with BouncyCastle. It has an implementation here but I don't know if it is out yet (in nuget).
FIPS-202 SHA3-256 (and all other SHA3 variants, e.g. SHA3-512, SHA3-SHAKE256) are implemented here, in pure .NET, with no dependencies on external APIs like BouncyCastle.
GitHub
https://github.com/series0ne/CORE/tree/master/Core/Security/Cryptography
Nuget
https://www.nuget.org/packages/SeriesOne.Core/
You can use SHA3.Net that is a SHA3 wrapper of the BouncyCastle implementation, implementing System.Security.Cryptography.HashAlgorithm
https://www.nuget.org/packages/SHA3.Net/

Which versions of SQLite does Zumero work with under Xamarin?

I am exploring Zumero for a new project and attempting to understand which SQLite it works with. Mono.data.sqlite, System.data.sqlite, Sqlite-net, or Sqlite-net Extensions. I prefer to use the Extensions version however I suspect that it will not work with it or the Sqlite-net because I would be unable to define the tables using the modified Zumero syntax.
I do need to be able to sync multiple smart devices with themselves and with desktop. Any ideas would be helpful.
The current version of our Xamarin component supports (and includes) System.Data.SQLite.
As you suspect, the ORM-ish features of Sqlite-net (and its variants) are not yet supported because Zumero tables need to be created a bit differently than regular tables. We do plan to implement this functionality, but I cannot yet promise a specific availability date.

PlayN - Managing Common Code / Native Code

I am thinking about using PlayN to manage "common code" in Java and use PlayN to generate iOS, Android, and HTML native versions of the common code.
I figure I could then use the playn-generated native code and link with actual platform specific code (such as UI).
In other words,
Common Code libs in Java-> PlayN -> Native Commond Code Libs -> Link with Native App
Is the use of Play for the above workflow/pipeline appropriate? Any challenges?
Thank-you...
Firstly, you have to specify what you mean by "native" code for the different platforms.
On Android, your java files are specifically compiled/prepared for dalvik. So they are already "native" of a fashion, no work needed to be done here. If you want to get C/C++ native code for Android using the NDK, you're out of luck. PlayN doesn't do this and this is a hard problem (going from Java to C++)
If you take a look at the Maven modular layout of how PlayN is intended to be used, it isn't difficult to define a Factory interface in the common code and pass in a platform specific implementation for each module. It's no big deal to support Android specific functionality this way.
For the HTML version, you can use HTML libraries no problem using JNI, although really garnering specific functionality of the browser I'd imagined of limited value compared to what PlayN has already exposed. The one thing that is useful is text/keyboard input, although I'd recommend triplePlay https://github.com/threerings/tripleplay UI library as they've solved this, and it's an active project.
As for iOS, this might be more complicated as the iOS module is a bit of a hack where the compiled Java classes are run through an JVM runtime for .net (IKVM) and then uses the Monotouch tools to compile the whole thing to native code for iOS. See https://github.com/samskivert/ikvm-monotouch
So for iOS, you won't be able to bind the code to any form of native version, and what you have access to via the toolchain method depends very much on what Monotouch has catered for iOS (quite a lot I imagine), and also what IKVM-Monotouch has supported (I imagine the bare minimum to get PlayN working).
I'm not familiar enough with the Flash pipeline to give you an appraisal, although I think that it's quite flexible.
The above answer is written assuming your app is actually a game. If it is not and you intend to use the standard widget libraries for various platforms on mass, it should be possible. Choosing a good MVP framework would be good here, and depending on the assumptions it makes on different host environments will determine how easy the whole thing will be.
I'd recommend reading and comparing https://developers.google.com/web-toolkit/articles/mvp-architecture and perhaps look at questions like What is your favorite GWT MVP Framework?
...although a lot of these frameworks might be GWT specific and not really have catered to being reused on other platforms.

Converting JavaFX 1.x scripts to JavaFX 2 Java code

Is there any tool to convert existing JavaFX 1.x applications to JavaFX 2.x Java code?
No such tool currently exists publicly and it is unlikely that one will be created.
Oracle did create a prototype tool which was used in internal Oracle development, but they decided not to continue development on it.
Quotes from the JavaFX project lead Richard Bair (from the forum threads linked below):
Richard: I'm sorry to say we have no tool to help with the migration. Our
experience from migrating the JavaFX Library and samples is that there
wasn't really an easy solution -- even the migration assistant that
was written was very incomplete. Some folks found it very useful, but
I just did it by hand.
PDVieira: Any chance you could send me the FxTranslator helper you've
created?
Richard: Wish I could, but unfortunately we cannot send it along
(actually, I don't even have the code on hand, didn't write it (Eamonn
did) and it would need to get legal approve to open source it, and it
probably doesn't even compile or work anymore because the platform has
change significantly since last December).
You can refer to these forum threads which discuss this further:
https://forums.oracle.com/forums/thread.jspa?messageID=9967190
https://forums.oracle.com/forums/thread.jspa?messageID=10064115

Resources