Difference Between Array and Collections - arrays

I read somewhere that array's are underlying data structures while collection are standard data structure can somebody explain this terminology I am not able to get it.

http://www.rapidprogramming.com/questions-answers/java-arrays-and-collections-differences-arrays-vs-collections-1604
this might help. Apart from this you can find other useful links also if you search on google.

Related

Are there ways to store a multidimensional array in a temporary excel or anything else?

I am trying to create an Addin which will copy certain attributes of a chart from First PowerPoint and read it to an Temporary Excel, which then can be used by a second chart in Second PowerPoint. Sounds simple enough, but the problem is, the attributes that I am reading happens to be a multidimensional array, which can't be written to an excel. So I have hit a roadblock as to how to tackle this situation.
On searching through internet, I came across something called localstorage and most of the answer seems to be surrounding javascript which I don't know, so didn't really understand much.
Because this strikes to me like a common problem which others might have also faced at some point in their life, so really hoping to take away some pointers from here.

Firebase: referencing docs with a string vs. referencing docs with a ref. Is there a difference?

This is more of a general question, I've been bouncing around multiple posts on StackOverflow and reading what I've found so far in the docs. I haven't found anything super concrete yet to answer the post question which is: what are the benefits of linking documents to one another through the ref type vs. the string type?
As of now, I'm converting all my string "refs" to properly typed "refs". However, since i'm still relatively new to the platform I'm scratching my head wondering if this is even necessary. I assume I'd be just as effective at finding related docs with the string as with a reference.
Also, for the sake of future readers as of me posting this, you can set a ref like so:
db.collection(...).add({
...
reference: firebaseFirestore.doc(
`lesson_translations/${translationID}`
),
// reference is now typed as a 'ref'
})
I had found other posts on stackoverflow accessing it with .doc(...).ref which doesnt seem to be a thing anymore.
It's mostly a matter of personal preference and perceived convenience. There is not really anything a reference type can do that a string and your own code could not also do.
Having a reference type mostly saves you the trouble of building a new reference object in your code, if that's what you would have done with a string document ID anyway. You can also use it in security rules for the same purpose when it comes time to use get() to fetch another document referenced by a field.
Again, it's personal preference. Do whatever is most convenient for you.
When you call a document reference, you instantly get the document details while if you take a string path and call it, it will take some time to find that data. It is just a matter of a few milliseconds and a few lines of code. Imagine if you had a list of document references to store and you store them as strings, and then had to call all of them looping over it
I know of one tangible benefit, but it's only relevant if you are using a library for data binding that supports loading nested documents to n depth. I personally am using vuefire, but I would assume something similar exists for the react ecosystem.
It allows you to e.g. bind a collection or document to a variable, and automatically sync all the data of referenced documents.
Example
You sync a collection('users') with a depth of two, and each user document contains an array of favourites:
{
name:'John',
favourites: [ref1, ref2, ref3]
}
The library would immediately download the references and replace the original ref files with the data:
{
name:'John',
favourites: [{title:'foo'}, {title:'bar', {title: 'baz'}]
}

What does S[1..n] mean for strings and arrays?

I've chanced upon quite a few reference books using definitions stating "for the string S[1..n]" and "in the array A[0..n-1]", and I did look up several sites in related fields but am unable to figure out what this notation means. I know that this question is probably trivial to many and may have been answered prior to this question in a related post, but some help will be deeply appreciated as I'm pretty much stuck..

Detecting closed routes in orientdb

How can I detect closed routes (circles) following different types of edges in OrientDB?
Let me give an example. I have two types of vertices, Ideas and Persons, and I have two types of edges, submitted_by and commented_by. No I want to find all "co-commented" ideas. Two ideas are co-commented if the submitter of the one idea is the commentator of the other. My approach was to follow the outgoing commentator-edges, see what ideas these persons submitted, following again the commentators to these ideas and see whether the original idea is among these. My problem is that OrientDB doesn't allow me to use aliases for "from-expressions" like class names, and so I cannot compare the id of the first idea with the ids of the ideas I get when following the edges.
I have to say, that I'am completely new to OrientDB and also to GraphDBs in general. So maybe there is a simple answer to that problem. But an answer would definitely help me to better understand how you typically work with OrientDB and maybe that answer might be helpful for others as well.

Cheapest Way To Export/Import Array Contents To File - AS3/AIR

I'm working on a basic editor application. It uses an array of varying size that I want to store to disk. This will eventually be in an AIR application, but for now it's just an AS3 project in Flex.
I want to store the array in a file. The application edits the data, so it doesn't need to be human readable. I want it to be in whatever format will be quickest to store and load back into the array when I need that data again.
Any recommendations?
Edit: It strikes me that importing/exporting in such a way that it can be immediately cast as an Array() would probably be the cheapest thing rather than some sort of iterating - if that's possible. Another obvious option is getting the data as a simple comma delineated string and using the String.split() function to get an array. Though again, the question is what would be cheapest - and I'm not quite convinced that's it.
I'll also add that it needs to be in some sort of permanent file, so a shared object - while possibly the fastest, isn't really a long term solution.
I think the fastest and easiest way is to use a shared object. It stores native objects, so there is no serialization / deserialization steps involved. Just assign the value and read it back.
Performance wise, probably the fastest route as well. If you are looking for a large dataset and are sure it's an AIR app, you can use AIR's db, but that will definitely take much more work.
First, take a look at this answer.
As for saving the contents of an Array, consider JSON using the export tools provided by Adobe.

Resources