Dart Implementation for Patricia/Radix-Tree - dart

I am writing a flutter app. For this I have to cache some places and want to search for names. For this purpose, I would like to use a radix trie.
I have searched for implementations under dart, but I have not found anything useful.
Did anyone know where I can find an implementation? Or has anyone ever bothered?
Greetings Dagobert

Radix-Trees are also called Tries, Digital-Trees and Prefix-Trees.
You can find a Dart implementation of a Trie here

Related

Anti windup on PidController

I'm using PidController in a drake project and I need of an anti windup control to limit the integral term growth. I was examine the PidController documentation,
https://drake.mit.edu/doxygen_cxx/classdrake_1_1systems_1_1controllers_1_1_pid_controller.html
but I cannot find functions or parameters related to this limit.
It is correct or i missed something in the documentation?
What's the smartest way to implement it?
Thanks
I agree; the current PidController implementation does not provide those features. It would not be too hard to implement this (by modifying the current PidController interface in C++, or providing a similar implementation in pydrake). And we would welcome a contribution like this if you wanted to make it.
For bonus points, the class should really declare witness events when the "clamp" turns on/off, so that error-controlled integrators get to know about this discontinuity.

how can I implement text-2-speech function in iOS app via firemonkey?

I have a iOS APP needs to spell out the words or phrase so the listener can type in the words they hear. How to implement text2speech with Delphi Firemonkey?
tried searching around the net, none useful found.
With help from EMBT, I found a solution from https://blog.grijjy.com/2017/01/09/cross-platform-text-to-speech/ It is a good solution to mine. Just wondered why EMBT NOT do this? Encapsulating such simple and important function to a special group directly from iOS/OSX foundations is easy,handy but important for developers using Delphi. FireMonkey has no such functions. Don't know what to say about this. EMBT seems having difficulty to find the key point as always.

F# Priority Queue

I have tried to use this snippet of code
https://code.msdn.microsoft.com/windowsdesktop/Net-Implementation-of-a-d3ac7b9d
to implement a heap-based implementation of Prim's algorithm to solve the Minimum Spanning Tree (MST) problem in a non-directed connected graph.
after a few iterations, i find that the heap/priority queue is not well maintained anymore.
that is the head of the PriorityQueue doesn't have the lowest Key in the Heap.
PQ 0 [-7230, 309]
...
PQ 146 [-7277, 308]
Has anyone use this code and experienced similar problems ?
I can post a link on GitHub if anyone would be looking at it
My needs are for a heap datastructure which supports deletion of an element in the middle. It looks like Fsharpx.collections doesnt have such a data structure.
does anybody know a good implementation available somewhere ?
thanks
Recently, I ported a MaxHeap from PLINQ to F# here and made it MinHeap. It is array-based and performs much better than any "pure functional" alternative.
However, after a lot of benchmarking, I found that SortedDeque based on just a simple sorted circular buffer performs significantly better on most use cases even when I need to add or delete in the middle.
My answer is inspired by V.B. but here it is in full
I have used another library than FSharpx.collections, it is called
Spreads
read that page for details and instructions.
SortedDeque is the data structure i need for this problem.
I used the same code, just changing from the microsoft blog page code to the library functions and found the good result, so it is indeed some bug in the microsoft blog page code
PS. this spreads library has been designed to format financial data for quantitative analysis and i'm happy i found it !!! IT looks like this library is rather recent and thats why its not on top of Google's search or referenced in any other SO question (or if it is i didn't see it)
FSharpx.Collections is of no use for that problem as you can see from that discussion heap issue in FSharpx.Collections

Why is there no Objective C AddressBook Framework for iOS, and how to best tackle the problems with C in Swift?

This might be really generic and rather about the framework in general than a programming question. But, in the light of Swift, and the tedious and sometimes impossible tasks you have interacting with C APIs, that question is very relevant.
When building a new app for iOS, I discovered that you can really have a hard time working with address book framework. First, there is the uncomfortable pointer passing that you have to do for many CoreFoundation Methods. Secondly, the functions mostly return that ugly Unmanaged objects, where you have to figure out if they are retained or not (ARC is several years old now!). Accessing the properties through their identifiers is terribly cumbersome and far from typesafe. And lastly, since there is no C Function Pointer Support yet, you can´t even call ABAddressBookRegisterExternalChangeCallback(addressBook: ABAddressBook!, callback: ABExternalChangeCallback, context: UnsafeMutablePointer<Void>) because the ABExternalChangeCallback is so far only defined in Objective-C!
Then I found that there is some nice Objective-C Api in the Mac OS Version of AddressBookFramework. How unfair! Isn´t the iOS Frameworks younger? Why do you think Apple did this? And when will they change this in your opinion? Did I miss something, and is there an Objective-C Api for iOS, too?
Any suggestions for how to tackle above problems in the most convenient and beautiful way are welcome, too! For my part, I´m writing a complete wrapper to obscure all the nasty pointer- C-Function- and global constants uglyness. As soon as it´s ready I´ll commit it to StackExchange and maybe Github to let others benefit and discuss my solution.
EDIT: finally managed to upload my wrapper to GitHub. See
https://github.com/SocialbitGmbH/SwiftAddressBook
I agree with you about what iOS provides to access to the address book.
I've posted an answer explaining how I handled the problem, using some functional aspects of swift, and how I dealt with extracting unmanaged objects.
Briefly:
I defined a custom operator to allow me chaining function calls to transform some input data
I implemented 2 generic functions to extract unmanaged objects
posted some code to show how I access to the address book, loop through all contacts, and retrieve some data for each one

Tools for searching full text in iOS bundle

Sorry for the generalized question...I have been hunting for a long time and haven't found anything I can use or easily adapt yet. I'd really appreciate any pointers!
I'm building a reference app that will contain several textbooks in plain-text format. I want the user to be able to perform a search, and get a table back with a list of results. I have a working prototype, but the search logic that I wrote isn't all that smart and it's been hell trying to make it better.
This is obviously a fairly common problem so I'm looking for a tool that I could adapt to the task. So far I've found Lucene (http://vafer.org/blog/20090107014544/) and Locayta (http://www.locayta.com/iOS-search-engine/locayta-search-mobile/)
Lucene appears to have been last updated for iOS 2...I don't even know if I'll be able to rework it myself. Maybe.
Locayta would probably work great, but a commercial license is $1,000 and I may not soon recoup that with this app, as it's a niche market.
Thanks!
We stumbled upon the same predicament where I work, and have yet to decide on a solution.
Locayta seems promising, but barring that, I've looked into SQLite's FTS3/FTS4 as well.
The only issue seemed the lack of a way to match partial words. It's easy to search for fields that contain whole words (eg. "paper" matches "printer paper", "paper punch", and "sketch paper"), or words that start with something (eg. "bi*" matches "binder", and "bicycle"), but there's no built in way to match a suffix.
If you don't require that functionality, FTS3/FTS4 might work.
I see you mentioned in the follow-up that your SQLite didn't recognize FTS3(), and I had the same issue at first.
Apparently it's not bundled into the iOS version by default, instead you have to download the SQLite3 amalgamation, and include it in the project manually. As found at is FTS available in the iOS build of SQLite?
Also note, the SQLITE_ENABLE_FTS3 variable is not enabled by default, you just have to add it to the configuration as detailed at http://www.sqlite.org/fts3.html#section_2
Hope this helps.
If you can translate plain C code to iOS Objective-C, then Apache Lucy (a loose "C" port of Lucene) might be worth a look.

Resources