AngularJS performance with many custom directives - performance

For this specific project, my team and I are thinking of leveraging the power of AngularJS directives and use them to build custom elements specific to our project, and use them like they were real HTML components.
For instance...
Say we have this table where each row is composed with a bunch of information that we get from a request, each row will be repeated with ng-repeat. Inside each row we will have multiple custom buttons with the same custom behavior. This button will also be used across different modules/pages on the website and not only on this specific table.
Our first thought was to use 2 directives, one for the table row and one for the button. The idea is that these are custom components/elements with custom attributes to define the custom behavior of the element. This would allow us to have a really nice modular application where each component is developed and unit-tested individually. Our HTML would also be easy to ready and understand.
Does this sound good?
Now, what about performance issues? Could we encounter big issues with this approach if, say we have a table with 100 of those rows and 5 of those buttons per row. Could this be big a problem if those rows/buttons had a couple of bindings to update information each X seconds?

The father of Angular Misko Hevery has this to say about performance and data-binding:
How does data binding work in AngularJS?
But in short like he says as long as you dont have more than 2000 data-bound items per page performance wont be an issue...

Related

ServiceNow Add a Form Section to multiple Configuration Items

I am currently working on a project in ServiceNow that requires me to configure around 500 descendants of the Configuration Item table by adding multiple form sections to the CI's with around 10-20 fields in each of these form sections. I currently am doing this by going into the Form Design for each CI, and manually adding these form section and fields for every CI individually, which takes far to long to do for 500 CI's.
Is there a way to add a form section to multiple CI's without having to go into the form design on every CI you want to change and adding it manually?
Technical answer: yes, because all of that form layout data is stored in tables (sys_ui_form_section, sys_ui_section, sys_ui_element, etc) that you could script to insert relevant records. However, due to the complexity (form sections, form elements, ordering) and the potential to run into conflicts (forms differ between tables), I would recommend this only as a last resort.
I think the real question is why is it required to have all of those fields displayed on the forms? If you're populating data from Discovery or a large import, can those fields just be visible by a list page, or just be available to use in filters? Will users actually be clicking to view a CI record and need to see that data on the form? The other part to consider is which view you are adding all of these form sections and fields to. As an example, a user won't see the data on a reference field hover if you're only making changes to the Default view, and won't see any of the fields on a mobile device if you don't add to the Mobile view.

Emberjs should I be using control for this

I'm attempting to build a FedEx style scheduling board. This would look just like a week view on a calendar but instead of days it would have driver columns. The trips should be able to drag and drop between columns and appear at the correct height for the time.
I'm abstracting to ensure I have the correct logic before tackling the actual code.
So lets say I have a date on the index controller. Selecting a date will load the schedule for that date. The schedule contains drivers and each driver has trips.
What controller do I use to handle the trips? The content is different depending on the column but each column needs to be visible. Also I need to add events to these which presumably uses a view but ember will only ever load a view once. I'm sure I've just missed something fundamental but all the examples of ember apps I've found involve clicking a list item and loading in a view for that.
Am I thinking about my application with the correct mvc setup? Should I be approaching the problem differently?
Ember RC1 introduced a notion of an itemController when iterating through a list in handlebars:
{{each trip in tripList itemController='trips'}}
{{view YourApp.TripView}}
{{/each}}
That way each instance of your trip can have its own trip controller. We're doing something similar, and this actually saved us a lot of work.

How to write <table> markup without JSF tag libraries (h:datatable or ui:repeat) but still use JSF for controlling page flow

I have various tables with the following size : 12 columns and up to 1800 rows. It takes 8 seconds to render it to the user. I currently use h:dataTable. I tried ui:repeat to get the row data from a Java List object, managed by JSF. Although this works fine, the 8 seconds to render the table is unacceptable. I'm trying to find other ways to do this, but need to keep JSF as my controller for action buttons on the page. In other words I want to create the 'table markupto send to thepage myselfand then still associate actions onh:commandButtons` to the managed bean methods. Is there a way to do this?
The only ways I can think of is to use jquery or ajax to create the table markup, although I am new to technologies other than JSF for UI development.Maybe then I would somehow pass that to the client for render. The only problem is I don't know how to generate the markup from my list, and second how I would inject it between h:commandButtons that are in my XHTML file currently.
Does any one know how I can solve this without having to completely rip OFF JSF? One main problem I have is that the business requirement that says we can't page the datatable (i.e: Next / Back buttons displaying 100 at a time for example). So, possibly I was thinking I could do this by Ajax calls to the server and get 100 rows at a time after page ready, and append new rows behind the scenes to the user. This would be a "perceived" speed of load, but I don't know how to do this at all.
8 seconds isn't bad for a whopping 1800 rows on 12 columns. 10~100 rows is done in less than a second, right?
Before continuing with this, are you absolutely positive that all those 1800 rows are supposed to be shown at once? Isn't this very user unfriendly? Wouldn't the user have to need Ctrl+F to find the information it is looking for? Isn't that annoying? Why don't you introduce filtering (a search field) and pagination exactly like as Google is doing to present the zillion of results in a sane and user friendly manner?
Anyway, you could consider using "On-Demand data" option of PrimeFaces <p:dataTable>, wherein the data is loaded by ajax during scrolling via <p:dataTable liveScroll="true">. See also the showcase example. No homegrown code nor manually fiddling with jQuery necessary. PrimeFaces has done it all under the covers.
It you don't want to use PrimeFaces for some reason, then you could consider using OmniFaces <o:componentIdParam> in combination with some jQuery "live scrolling" plugin. See also the last example in its (snapshot) showcase page for a kickoff example (which should easily be adapted to be triggered by hitting the scroll bottom instead of by clicking).

How to insert multiple rows into embedded view from a subform? Lotus Notes

I have a section that contains a subform ( containing 3 editable fields for the user ).
Then I have an embedded view categorized having two actions: Add and Trash.
What i want to do: After the user complete the 3 fields and then press Add, the first row in the embedded view will appear. ( This easy thing I did ). But then after the first click on Add, I want that all the 3 fields to be refreshed, all of them to have as their value: "".
After, if the user wants to add another row into the embedded view (with different values), in my case it is overwrited on the 1st row. I want to be separate rows in order.
I tried something with #Command(ViewRefreshFields) into the Add action code but I didn't make it to work. Please help, J. U.
Jazir, I'm guessing that you also go by the names "Florin G Mihalache", "Josh Mitchell" and "Yveniss Ltoreau", and I've been following the development of your application along with many other professional Notes developers.
I really think you need to go back to the very first basics, and work out the difference between forms, subforms, documents, views, embedded views, and other important components of Lotus Notes databases.
I strongly suspect that for a couple of weeks you have been trying to use a form to create other documents, via a subform, to be displayed in an embedded view in that form, when what you should be using is just a view, and documents. Perhaps you might need to use pages, outlines and framesets. It is very important that you understand these basic concepts before confusing the people who have tried to help you, to whom you may have lied.
I have voted your question down, not just because you have shown a lack of research, but because you appear to keep switching ID when people lose patience with you. I will undo that vote if I become convinced that you are not Florin.
The documents displayed in an embedded view are controlled by the view's selection formula. You haven't shown that. You haven't shown your code in the Add button. You haven't shown what properties you have set on the embedded view -- e.g., show single category. So you're not giving us quite enough info to diagnose your problem and help you.
But in general, I think that if you want to control the order of insertion of individual documents into an embedded list, perhaps using an embedded folder would be a better idea than an embedded view.

Core Data and poor performance

I've been working this issue for a while now and I am open to any best practices/advice.
The Example
So I created a sample Core Data application. The application is basically a mimic of the AddressBook application. I have the following Entities: Group, Contact, Address, Phone, Email, Webpage, Dates.
As you probably are guessing, a Group can have multiple Contacts, and a Contact can be in multiple groups. Contacts can also have multiple Addresses, Phones, Emails, Webpages, and Dates.
I basically imported some 600 contacts into this application from AddressBook. The user-interface is relatively simple...a Group/category list on the left and an NSCollectionView or NSTableView on the right that shows the list of contacts depending on the selected Group.(collection view or table view...as I added the ability to display either view, both of which are bound to an NSArrayController)
The Group elements I am pulling in through code as opposed to Interface Builder, becasue I wanted to playaround with a Thing's - like sidebar, and it was far easier to do it this way.
The Problem
One of the categories contains all of the contacts while the other category contains merely 2 contacts. When i select the category that has all the contacts it takes anywhere from 8-10 seconds for the information to populate the collection or tableview. However doing the same thing in AddressBook itself is very speedy, almost instant. I am using the SQLLite store type, and have tried using a number of different approaches including trying to diagnose the problem via Instruments, but nothing has worked.
I've tried setting a predicate to the defaultFetchPredicate of the Contact's array controller as opposed to setting a filter predicate, but that didn't work.
I tried preFetching and faulting but i'm not sure if I'm doing it right, and not really sure how to accomplish it if Interface Builder handles the Contact's NSArrayController.
The Other Example
I've also tried downloading a sample Core Data app...while it has a simpler relationship model than what I did(basically a Molecule has Atom objects and an Atom object has Element objects), I inserted 65,000 records and it performed like a charm.
The Question
I've basically hit a wall and I'm wondering if anyone else knows why this is happening and the best ways to fix/overcome/avoid this type of issue?
Thanks!
It turns out that it was actually the NSCollectionView that was slowing things down. I guess the creation and manipulation of views x number of collection view views adds a significant amount of overhead. IKImageBrowserView could have been used but it wasn't what I was looking for.
I ended up changing the application layout to solve this issue.
Thanks all!

Resources