Do I need to count 3 functions (create, update and delete) in Function Point Analysis? - function-points

I have an ILF that receive External Inputs (EI).
Do I need to count 3 function points? (create, update, delete)
Or I need to count just one? (maintain)

I think yes. I found this: http://www.devdaily.com/fpa/fpa-borland/ei-delete-processes.shtml

Related

Is there any way to update multiple child values at once?

I need to set all the child distances to 0 (check photo of Firebase db below) in 1 setting. Is there any way I can do this? The usual update function for Firebase generally works for only one userID.
To write a value, the client must specify the complete path to that value in the database. Firebase does not support the equivalent of SQL's update queries.
So you will need to first load the data, and then update each child. You can perform those updates in a big batch if you want, using multi-location updates. For more on those, see the blog post introducing them and the answer here: Firebase - atomic write of multiple values to multiple locations

RxSwift - order of emit on PublishSubject

I know, that all types of Rx subjects can get elements in subscribe not ordered correctly, eg. if I send three elements in order 1,2,3, there is an option to get it on this order: 1,3,2.
I wonder, is there a way to force the order of emitted elements the same at the start and at the end?
Only if you update it from different threads. Use .serialize() to ensure correct order.

Does core data have FIFO?

I would like to ask is there any FIFO examples for swift coredata?
For example, I only allow user to stores 50 history. So when a user store another history, no. 51 will be entered, and no. 1 in core data will be deleted automatically.
Thanks!
You'll have to do this yourself. Managed objects aren't created or deleted automatically in most cases, so if you want to limit the number of instances of an entity, you need to write code to do that.
You'll probably need to add an attribute to your entity to keep track of the order, so that your code would know which was the first, second, etc, and work out which instance(s) to delete. That could be an integer index, or a creation date, or maybe something else.

Randomize Selections in a List of 100

This is a follow-up to this last question I asked: Sort Users by Number of Followers. That code is:
#ordered_users = User.all.sort{|a,b| b.followers.count <=> a.followers.count}
What I hope to accomplish is take the ordered users and get the top 100 of those and then randomly choose 5 out of that 100. Is there a way to accomplish this?
Thanks.
users_in_descending_order_of_followers = User.all.sort_by { |u| -u.followers.count }
sample_of_top = users_in_descending_order_of_followers.take(100).sample(5)
You can use sort_by which can be easier to use than sort, and combine take and sample to get the top 100 users and sample 5 of those users.
User.all.sort can "potentially" pose some problems in the long-run, depending on the number of total users, and the availability of resources particularly computer memory, not to mention it would be a lot slower because you're calling 2x .followers.count inside the sort block, which essentially calls 2xN times more DB query; N being the number of users. This is because User.all.sort will immediately execute the User.all query, thereby fetching all User records into memory, as opposed to your usual User.all, which is lazy loaded, until you (for example use .each, or better yet .find_each somewhere down the line)
I suggest something like below (I extended Deekshith's answer referring to your link to the other question):
User.joins(:followers).order('count(followers.user_id) desc').limit(100).sample(5)
.joins, .order, and .limit above will all extend the SQL string query into one string, then executes that SQL string, and finally run .sample(5) (not a SQL anymore!, but is already just a plain ruby method at this point), finally yielding the result that you needed.
I would strongly consider using a counter cache on the User model, to hold the count of followers.
This would give a very small performance impact on adding or removing followers, and greatly increase performance when performing sorts:
User.order(followers_count: :desc)
This would be particularly noticeable if you wanted the top-n users by follower count, or finding users with no followers.
User.order(followers_count: :desc).limit(100).sample(5)
This method will out-perform others using count(*). Add an index on followers_count for best effect.

VirtualStringTree - Any way to determine when a collection of nodes have been checked?

I have a VST using TriStateChecking. This is connected to a database table, so when the user checks a node, its checked field is updated in the database. I would like this to be invisible to the end user; that is no 'Save' button.
I am currently using the OnChecked() event to update the database. The problem is when checking large number of nodes, it essentially executes #CheckedNodes SQL update statements. What i would like to do is capture/be notified when all the tristatechecking is complete so i can simply scan the tree and construct one SQL update statement.
Is there an event i could use once all tristatechecking has completed?
No, the iteration is the only way to do it. Even CheckedCount property do it in this way.
Just have an internal list where you could store checked nodes and onChecked event update the list. When checking large number of nodes, just iterate through your list and construct SQL statement.
Just doing some tests, but it looks like i can simply use the OnMouseUp() event. Should have probably checked before, oops.

Resources