Swif'ts Array to Realm's Result - arrays

I am trying to convert Swift [Object]() array to Realm's Results<Object>!. I know that vice-versa is possible (you can see here) but is it possible to do what I want?
So I want something like result as! [Object].

Result objects are proxies for data stored in the db. You can only get them via queries, but cannot instantiate them yourself (see the docs).
To still get Result objects, you'd have to run a new query for the objects you already have, and use the returned Result... I would not suggest that though.

Related

MongoDB aggregate returning an empty array

So, my problem is, that in MongoDB that .aggregate() function is not working
Heres some pictures:
You can see what a tried on the first picture
When using "$lookup", it's important that both "localField" values and "foreignField" values have the same type.
In this case, "localField" is a string and "foreignField" is an ObjectId.
It's probably best for queries to use ObjectId's for both.

What type of datastructure is this: a:114:{s:12:"notification";a:1:{i:0;a:5:{s:8:"email_to";s:24

I'm working with a Wordpress database and want to create some reports on the data. One of the tables contain information which is stored in this format:
a:201:{s:16:"arfmainformwidth";s:3:"550";s:15:"form_width_unit";s:2:"px";s:8:"edit_msg";s:39:"Your submission was successfully saved.";s:12:"update_value";s:6:"Update";s:12:"arfeditoroff";b:0;s:19:" ....}
What I figuered out is that the first letter is the datatype: a = array, s = string ... and the second value is the length.
I saw this format in different other tables from other plugin and want to know how is it called or if there's any type of function which can parse this data. I don't even know how it's called.
I'm working with Wordpress and ARForms. Caldera Forms include this data aswell.
your help would be appreciated
This is the serialized representation of an array. You should be able to unserialize it by calling unserialize() on the string above. This is mostly used when you want to persist a temporary state of an object or you don't want to create database table structures for each and every bit of information.
More to find here:
https://www.php.net/manual/de/function.serialize.php
https://www.php.net/manual/de/function.unserialize.php

How to know if a field is an array in elasticsearch?

I would like to know which field are array in my index in ES 6.8.3.
When I retrieve the mapping of the index via Kibana API :
GET structured_data/_mapping
I only get the kind of the value within the array.
It is a problem because when I want to load the data from spark, if there is an array field, I need to specify it otherwise it will raise an error.
Thanks in advance,
Louis
there is no dedicated data type array in Elasticsearch. Look at this link you don't have to specify anything specific in the mapping to store an array of values. Look in your source data if that contains an array, ES should take that array, given all the data inside that array is same data type

VB.Net - Excel application get showing values of an range

I'm trying get an Excel Range and copy into an array of objects with Vb.Net.
This is not a problem. I use the following code:
Dim vValues(,) As Object = ExcelApp.Range(vRange).Value
And works fine; but I have a the following case:
In the column "C"; the value has a specific format and internally has another value.
My question is:
Somebody know the way to get the information exact as the user see?
I'm trying to get the information without use a For ... Each or some kind of cycle.
I'm also tried to avoid use "text to columns" function.
Both seems right solutions, but would impact the performance with a lot of data.
FYI: Also I can get the information through the ODBC connection; but I'm searching the solution using a Range
Exactly what the user sees is the Text property. But you cannot have an array of that, you will have to query each cell individually.
You are getting a Double value in your array instead of a DateTime value because you have "Time" formatting applied in Excel. If you had a format from the "Date" category, Excel would instead send a proper Variant/Date, not a Double that represents it.
Another option would be constructing the DateTime objects on the .NET side, provided you know in which columns they should be.

How to use NSPredicate with NSPredicateEditor on different data (Multiple Predicates?)

I've got an array of filepaths and I've got a NSPredicateEditor setup in my UI where the user can combine a NSPredicate to find a file. He should be able to filter by name, type, size and date.
There are several problems I have now:
I can only get one predicate object from the editor. When I use
"predicateForRow:" it returns (null)
If the user wants to filter the file by name AND size or date, I
can't just use this predicate on my array anymore because those
information are not contained in it
Can I split up a predicate into different predicates without
converting it into a NSString object, then search for every #" OR " |
#" AND " and seperating the components into an array and then
converting every NSString into a new predicate?
In the NSPredicateEditor settings I've some options for the "left Expression":
Keypaths, Constant Values, Strings, Integer Numbers, Floating Point Numbers and Dates. I want to display a dropdown menu to the user with "name", "type", "date", "size". But then the generated predicate automatically looks like this:
"name" MATCHES[c] "nameTest" OR "type" MATCHES[c] "jpg" OR size == 100
Because the array is filled with strings, a search for "name", "type" etc. and those strings do not respond to #"myString"*.name*m the filter always returns 0 objects. Is there a way to show the Name, Type, Size and Date in the Menu, but write "self" into the predicate without doing it by hand?
I've already searched in the official Apple tutorials, on Stackoverflow, Google, and even Youtube to find a clue. This problem troubles me for almost one week now. Thanks for you time! If you need more information please let me know!
You have come to the right place! :)
I can only get one predicate object from the editor.
Correct. It is an NSPredicateEditor, not an NSPredicatesEditor. ;)
When I use "predicateForRow:" it returns (null)
I'm not sure I would use that method. My general rule of thumb is to largely ignore that NSPredicateEditor is a subclass of NSRuleEditor, mainly because it's such a highly specialized subclass that many of the superclass methods don't make that much sense on a predicate editor (like all the stuff about criteria, row selection, etc). It's possible that they're somehow relevant, but if they are, I haven't figured out how yet.
To get the predicate from the editor, you do:
NSPredicate *predicate = [myPredicateEditor objectValue];
If the user wants to filter the file by name AND size or date
You mean (name = [something]) AND (size = [something] OR date = [something])?
If so, NSPredicateEditor can do that if you've set the nesting mode to "Compound".
I can't just use this predicate on my array anymore because those information are not contained in it
What information do you need?
Can I split up a predicate into different predicates without converting it into a NSString object, then search for every #" OR " | #" AND " and seperating the components into an array and then converting every NSString into a new predicate?
Yes, but that is a BAD idea. It's bad because NSPredicate already contains all the information you need, and converting it to a different format and doing string manipulations just isn't necessary and can potentially lead to complications (like if someone can type in a value for "name", what happens if they type in " OR "?).
I'm having a hard time trying to figure out what it is you're trying to do. It sounds like you have an array of NSString objects that you want to filter based on a predicate that the user creates? If so, then what do these name, date, and size key paths mean? What are you trying to do?

Resources