How do I use LevelDB from Dart? - dart

I'm looking into Dart for server-side development and one of the things I'd need to use if I went that direction was LevelDB. There is a port for the JVM that I could use from Java or Groovy but I haven't been able to find anything in Google that points me to a leveldb package for Dart.
I know it's possible to write a native port that uses the C++ API but I'm neither a C++ nor a Dart programmer so while that's theoretically possible, it's out of the question for me personally.
Since LevelDB and Dart are both Google initiatives, surely there's integration somewhere isn't there?

I have written a LevelDB binding for Dart at https://pub.dartlang.org/packages/leveldb. Please try it out and file bugs for any issues you see.

To use LevelDB, which is written in C, you'll need to use the Dart VM's native extensions API. At the time of this writing, there is no open source binding for LevelDB and Dart VM.
Thanks for the question!

Related

Is it possibe to write Gnome extensions in Dart and compile it to JS?

In theory it looks like it should be possible. There is: Dart-to-JavaScript compiler and even package to call JS from Dart and opposite.
But I didn't find any resources about it. Did anybody tried? Does anybody knows for sure that it is not possible?
Short answer: maybe, but I seriously doubt it's worth the effort.
To do anything useful with JavaScript, you need to write for a platform like the Web API, node.js, or GNOME in the case of GJS. Dart seems to support the Web API with its web library and its own platform with the vm library.
You might be able to write a transpiler that could transpose from a subset of Dart to GJS, but using any existing dart transpiler is probably impossible.

Using COM from an F# script

How do I use COM libraries from an F# script? Is it even possible? How do I reference the required COM libraries in an .fsx file?
More specifically, I'd like to use InstallShield Automation from a build script. Despite all my efforts, I could only get it to work with a regular compiled project.
Edit: I already tried the COM type provider project. However, it doesn't seem to find any types in the particular COM library I'm interested in. If it's a bug or intended behavior, I don't know.
I think possibly maybe the COM type provider might help you out:
One advantage of this method is that you can author and deploy F#
scripts without having to pre-generate the interop assemblies. Another
advantage is that you can easily explore all the COM components
installed on your machine via intellisense.
And yes I did just google it, which OP also might have done before asked here.

Automate JavaScript Interop in Dart

When using a third-party JavaScript library in my Dart project, I manually go through the library's documentation and iterate through its properties and methods to build the Dart code through a series of tedious context and callMethod calls. Has anyone figured out a way to automate this?
I tried to first find a command-line interface that introspects the JavaScript library so that I can auto-generate the Dart source code. I've been unsuccessful in my search.
I've tried to make my implementation of .d.ts -> dart2js annotations converter.
This is possible way to automate the process.
Please, see https://github.com/denis-aes/DefinitelyTyped.dart
Introspecting JS lib can be really hard due to the dynamic face of the JS language.
In the Typescript world there are *.d.ts files used to provide types to existing libraries. As far as I can tell most of those files are manually writen.
For now such a tool isn't yet available.

Java2dart, how use it

I have downloaded the sources, then... I don't know what I'm supposed to do.
I think that we have to compile these, but I'm not really familiar with java.
Do you have a complete example for use it ?
The java2dart tool was written for Google's own use, to help convert many of the tools from Java into Dart. Is was not intended to support conversion of all Java apps; just what was required to get things like the IDE tools (Analyzer, etc.) into Dart.
As such, there's not a huge amount of info on what it can/can't do or the best way to use it. It is written in Java, and there doesn't appear to be a pre-built binary; so it would almost certainly involve compiling the Java yourself. Unfortunately I have almost zero experience with Java (or fortunately, depending on your point of view :))
You can find a little info on this in the Dart Google Group here:
https://groups.google.com/a/dartlang.org/d/msg/misc/4mSK-M7dm2U/ARbTh6emb-sJ
I wonder whether anyone has tried running java2dart on java2dart to get a nice Dart version? :) Or even then running it through dart2js to get a JavaScript version! ;)

Dart code instrumentation possible?

I know that Dart's VM is a "language VM" as opposed to a bytecode VM. Is there a way to do the equivalent of bytecode instrumentation on Dart code?
As far as I remember there was a similar question somewhere recently (Dart Google groups) in relation to profiling and the answer was no.
You can do code generation like Angular/DI does it to replace dynamic injection with static injection (Polymer transformer does something along this lines).
But that is only possible before the program is started.

Resources