Ada: linked list example in Naiditch's book - linked-list

In Chapter 11: Access Types of the book: Rendez-vous with Ada by Naiditch (1995), Naiditch gives a rather complete example on how to create a linked list that contains information about a restaurant. I understand largely the data structure following the book's example. I can understand that any information that the user is entering in the linked list will only exist during the lifetime of a program. The author is not storing any information about the restaurant say as text files. So what's the use of the linked list example if all information entered by the user is not stored after the user exits the program?
Does it make sense to store user entered information say in a text file and then read them into a linked list so as to do further operations on them? But then doing operations such as adding or deleting entries will disturb the original text file from which the linked list was read from at the start.
Thank you.
PS: As you might have noted, I am trying to get a real-life example of a linked list and I am new to this data structure as well.

As discussed here, the 1995 example predates the addition of Containers to the predefined library of Ada 2005. The textbook example may guide your understanding of concrete implementations encountered a particular Ada library. See 8.1 Organization of containers for an overview.

Related

What does ZCD segment refer to in HL7 message?

Does anyone know what ZCD may refer to? It is described as a segment with a link back to PreManage for the patient!
Can anyone please provide more details?
The Z segments (segments those begin with the letter "Z") are custom segments. Those are not defined in specifications. They vary from vendor to vendor. Vendor may publish a document explaining usage of segment. Two connected parties should know in advance and decide the usage by mutual understanding.
As those are custom, and if there is no way to know what data they contain, it may be safe to neglect them hoping the sender have not put critical data in it.
Please refer to this:
Z-segments can be inserted anywhere in the HL7 message. A popular approach is to place the Z-segment within a group of segments that contain similar information, such as insurance. Z-segments are also often placed at the end of the message. The advantage of doing so is that this placement prevents systems configured to parse “standard” HL7 format from requiring any configuration modifications in order to process the message. The application simply reads the segments in the order expected and then extracts the data from the Z-segment (if needed) via parser modifications.
Working with unexpected Z-segments
Sometimes systems may send unexpected Z-segments, whether or not they were part of the original specifications. Even if you are not interested in the data in the Z-segment, you may still (depending on its location) need to take the segment into account while testing and developing your interface.

Shared text document where users can type in realtime Swift IOS

My goal is to create a text view where two users can type at the same time in a text document (for example UITextView). I am currently using firebase as my database.
One way one could implement this is to update a document all the time from firebase with listeners attached to it that update the text. This approach isn't very practical and can cause confusion right away when one internet connection is poor.
Is it possible to create a shared text document in Swift where two users can type? And is there a more convenient approach to it than mine?
What you're describing is essentially what Firepad does on the web.
You could consider using its source code as the basis for your solution, paying special attention to the operation transform implementation in there, which is what makes its multi-user editing of a single document possible.

Rails: How to query records in different languages

I have a Rails inventory app that is available to global users, allowing them to enter their own inventory information and query those of others.
a British person in London adds 10 units of "bicycle" to the inventory table
a Japanese person adds 2 units of 自転車 (bicycle in Japanese)
a Vietnamese adds 5 units of xe dap (bicycle in Vietnamese)
The British person can query 'bicycle' and it will output all bicycles in the system (17 units) and can show the details of each in their original language, without the users classifying them beforehand. Likewise, the Japanese person can query '自転車', which will show all bicycles.
How can this be done?
The globalize gem requires users to manually translate each record so it's not the correct way. I've heard about machine learning and deep learning but I don't know if it's the right solution for this.
So if stackoverflow is not the right place to ask this? Where should I ask? Quora does not allow long questions.
Machine learning does not seem like a proper solution in this context since you don't have enough experience with it and it's a complex matter to just start with it and learn enough to apply to a real life problem.
Here are a few solutions you could implement today, as long as you understand the requirements and the up/downs for each, you will have to figure those out by yourself.
Since I don't have enough information about your system I'll try and generalize it to something that's likely.
Solutions:
1.Define a limited number of items for your system, like Bike and add
them to a config file or in a items database, each item having it's
unique id and when a user will have to add something they will have
to select from your list. Have a Other item as a catch-all, and
maybe provide a note so the users can add anything to recognize the
item.
2.Similar to the above solution but you give the users a way to add new items into the system, so you have 10 standard items and every user can add items to the site (those being moderated) and other users will have access to them.
3.Have a solid search system in place like Elasticsearch (or anything else), and when the user create items you index that item in the language that is entered, and then use Google translation API (or another translation service) to translate them in all the languages you need and index those for search as well.
I think solution 1 is the best if you are able to implement it followed by solution 2.

Linked list in data flow diagram

Is this correct?
What i basically want to ask is that- Is it correct to consider a linked list as a data source.
What happens in this program is that a text files contents are loaded into memory in a linked list. Which does all the processing work and then when the program quits the linked lists are written to the file. In that case is this DFD correct?
What you are asking is rather a Data flow diagram, or also known as dynamic/event view of design.
This diagram tells how on the UI ,events will proceed.
What i basically want to ask is that- Is it correct to consider a
linked list as a data source.
Yes of course, Sometimes it is good to proceed with Link List. LL provides a simpler and faster way to move through nodes having various attributes of a specific entity.
What happens in this program is that a text files contents are loaded
into memory in a linked list.
Basically its not a good idea to store data as text,it increases parsing overhead.The Node values in LL are rather stored in binary format in such a way that when a program loads them, it can quickly link all the interconnected nodes.
Which does all the processing work and then when the program quits the
linked lists are written to the file.
Difficult to understand what you want to ask, but if you are asking who does processing work then obviously its your program who parses the data saved in file.Your program will also dump changes to file if you make any alteration in previous data.
In that case is this DFD correct?
Hard to tell, untill whole requirement is known..

Mahout recommendations with metadata related to preference

I was planning to write a recommender which treats preferences differently depending contextual information (time the preference was made, device used to make the recommendation, ...)
Within the Mahout in Action book and within the code examples shipped with Mahout I can't seem to find anything related. In some examples to there's metadata (a.k.a content) used to express user or item similarity - but that's not what I'm looking for.
I wonder if anyone already made an attempt to do sth similar with Mahout?
Edit:
A practical example could be that the current session is done on a mobile device and this should cause a push up (rating*1.1) for all preferences tracked on mobile devices and a drop for preferences tracked differently (rating*0.9).
...
Another example could be that some ratings are collected implicit and others explicit. How would I be able to keep track of this fact without "coding" that directly into the tracked value and how would I be able to use that information when calculating the scores?
I would say one approach is to use the Rescorer class to do just that, but my guess is that this is what you are referring to when you say that's not what you are looking for.
Another approach would be to pre-process the entire data you have to adjust the preferences according to your needs, before using Mahout to generate recommendations.
If you provide some more detail on how you expect to use your data to modify preferences, people here would be able to help even further.

Resources