iPhone app freezes briefly during fetch for content updates. Can this be fixed? - ios4

I have an iPhone app that displays blog articles. You can drill into one article and look at it's entire story. At the bottom of the story are comments from other users.
The app fetches latest comments from the server every 15 seconds. If there are more comments returned, the app prepends them to the top of the list. This is all working pretty well.
The problem is that, whenever the app does the fetch (every 15 seconds), the app sort of "freezes" for about 1 second, sometimes 2 seconds. If you are scrolling through the comments, this delay becomes pretty noticeable because the scrolling stops in place while the update processes.
This iPhone app is being developed by a third-party dev team who is remote. I have asked the dev team to stop the "freeze" from happening, but they insist that it's normal functionality when updating a table in the iPhone.
I am not an iPhone developer and have no knowledge or experience of working in that environment, so I am not able to really argue against this. But, I have to imagine that there is some way to do a background fetch and update of the table without causing lag to the user experience.
Does anyone have any thoughts around this? Are there techniques that the devs could be employing to create a smooth experience during the update process?

They are fetching comments in synchronous mode in which UI will hang until it downloads completely. Tell them to download content in asynchronous mode so that it will fetch comments in background and UI scrolling will be smooth then.
Example Codes:
[connection startAsynchronous];
https://gist.github.com/fspeirs/106457
http://allseeing-i.com/ASIHTTPRequest/How-to-use
Let me know if you find any difficulty.

Related

Does Yandex Metrica Slow down the site speed?

I am using Yandex Metrika for my site Thegoldlive.com and facing a Core Web Vitals issue due to it. I believe it's the main reason due to why my site is getting slow. Any way to get rid of it or should I remove this from the site?
When I remove it from the site, the speed of my site gets better. But, I don't want to remove it because it helps me analyze the visitors on site in the best manner. So that's why asking, is there any way to keep both things parallel?
Running your site through PageSpeed Insights it appears your issues are with loading time (TTFB, FCP, and LCP) and shifting content (CLS).
I'm not familiar with Yandex Metrika, but it seems unlikely an analytics solution will slow down these metrics. Mostly they affect responsiveness metrics like FID and INP.
I can't quite see the reason for slow TTFBs (it seems fast to me!), which will directly affect the other loading metrics. You seem to be using a CDN (cloudflare) and the server response time from lab tests seems fast.
It could be you just get a lot of visitors from slow networks/devices? If so one thing that can help here is ensuring sites are eligible for the Back/Forward cache, so at least they get a fast (instant!) load when going back and forwards within the site. Testing your site for this shows your site is using an unload handler, meaning you can't benefit from this performance gain. It looks like you are using Cloudflare's Rocker Loader - ironically something that's supposed to improve performance but that might be holding you back here. I'd turn that off.
For your layout shift issues (CLS), it's must more obvious. You have an advertisement that pops in and out and pushes all the content down. You'd be better to reserve a block of white space for that to slot into, rather than have it dynamically inserted and moving the text around, which is an irritating experience for site visitors.

What is the best approach to build a Dashboard?

Let me start with a brief explanation of this question. I've been recently getting started into web development. I know the bits and bytes of modern MVC architectures and have already been using it. But now that I am planning to build a Dashboard, I am confused about how to do it.
The traditional flow of data is, it is loaded from database at the backend, processed a little and sent in a response to the frontend. This is what I have worked on till now.
But talking about dashboards, assume that the data that should be shown on the dashboard requires too much processing. Like suppose the dashboard shows how much the person has spent/earned till now.
Now, adding some background context. If the application was about showing how much the person has spent at an online shopping site till now, it might not need too much processing. Loading a few hundreds of records might be okay (maybe!).
But if the dashboard is about showing how much an intraday trader has spent/earned till now (since he/she joined) would be too heavy. In this case, loading tens of thousands of records and calculating (adding/subtracting) will result in load on the server.
In this case, I am thinking about having a separate table for reports which is updated as and when necessary (for ex: when a new trade is executed by the user). And then simply reading and sending the data to frontend. Also, a bit of processing maybe done if needed, but all the heavy work is already done.
These two examples can be classified into two categories:
Processing in real-time
Processing ahead of time
Now, the question I have here is, "Should I always use the 2nd approach?" I have this question because if the processing is too less, then creating separate tables for reports is just a waste of storage. So, there are trade-offs that I can think of.
Now, coming to the second part of this question. This part refers to how should I be handling data changes at frontend. Three possible ways are:
Periodic changes (okay if the data updates are less frequent)
Instant / Real-Time changes (using something like data streaming maybe?)
Instant / Real-Time changes, but only sending the updates (new changes that took place) and not whole data to frontend
Now, coming to what I think about this part. If the data changes are less frequent i.e. once in a day, it's okay to go for the first approach. But I am still unaware about the 2nd and 3rd one. Also, should I use data streaming and can anyone provide some insights of how streaming differs from a normal request-response cycle? I think this might be related to websockets or something similar but I am unaware.
PS: I am currently using Django as my backend, and am planning to use React/Vue or similar framework as my frontend. (The answer will be independent of this, but just for information)
With modern front-end technologies, it doesn't really matter if you use pulling data from the server (periodic update) or pushing data to the front-end (instant/real-time). For angular and React you should look at Observables, using this on the front-end both options are treated exactly the same.
In an event-driven front-end, it doesn't matter how you get the data you will write your program to handle the event of "when my data arrives, I will do XYZ"
Generally speaking, it would be better to break your next question down in to 1 or 2 very specific questions. Instead of asking a very broad question with tags "front-end", "back-end" and "everything-in-the middle", you could ask several specific questions focused on each aspect.

Detecting when a user is away outside of the browser

I am building a "status" stand alone application customized specifically for my company. In my app, a user will open the web site and update his/her status to one of several buckets (away, at my desk, out of office, etc) and THEN the user will most likely minimize the application. My issue is how to detect when a user is away if they are not navigating within the status application browser window. If a user were only navigating within the app, detection is easy-
#HostListener('mousemove', ['$event'])
However, I need a solution where I can detect desktop inactivity and then (after 15 minutes) update the user status to 'away' in the database.
I am early in the development process, and am open to a different approach. The technologies I am using is Angular 8, Node js API, and Postgres SQL. Ideas?
EDIT: From the comments, I understand that communicating with the desktop is not possible. So at this point I am hoping on high level ideas on how to architect this while achieving similar results described in my post. tcp/ip socket that updates user status from the api if the connection is broken when a desktop enters sleep mode? Any crazy ideas?

windows phone out of memory exception

I am developing windows Phone application. In my application am using Longlistselector and loading long lists with images using MVVM. Also in the details page after lists there are few high res images.
In my application am going from Page 1 to Page 2 and page 2 to page 1 n number of times.
Application is crashing in back navigation giving ArgumentOutOfRangeException and OutOfMemoryException.
I have done the Windows phone application analysis. Its showing GC events are getting called frequently. However it does not show at what point application crashes and how to reduce or how to clean up memory used by application.
If anyone knows about memory cleanup and how to prevent memory leaks please let me know.
The biggest gotchas for memory leaks are event handlers not being released. Whenever you subscribe to an event, you also need to unsubscribe the event when the updates are no longer needed. I'd guess that your page 2 isn't actually going away when you navigate back to page 1.
I believe there are a pair of overloaded methods (OnNavigatingTo and OnNavigatingFrom, I think) that can help you manage this.
Another way is to use a WeakReference and manually pass along any data with an EventAggregator. Probably the easiest one to use is part of the MVVM Light Toolkit (the Messenger). This Weak Reference won't have your event senders hold references to your subscribers.
You also have to remember that windows phone is a new paradigm. You do not navigate from page to page, but rather to a page and back to the previous page. If you are going forward all of the time, you will have new instances of the pages in the navigation stack.

Should I wait before publishing App with Core-Data and iCloud until it is more stable?

(as at 1st June 2012)
A very simple question I would really appreciate input from others (I think we all could) who are either wondering the same or have decided to go with it (if so, any user experiences shared would be great).
I have 2 main issues which seem common on stackoverflow and on various blogs, so I know I'm not the only person experiencing them.
Occasionally my sync gets corrupted for one reason or another and the sync either fails on certain data or fails to sync altogether.
Pre populating data is essential for my app, there's no reliable way of doing this (without asking the user - which isn't reliable)
I've seen many good work arounds to both these issues but I can't help feeling that my users will encounter problems still.
I'd be really interested to learn of any experiences particularly from those that have decided to publish using iCloud and Core-Data.
iCloud has been around a while now but even on iOS 5.1.1 it doesn't seem stable enough, surely a more reliable version can't be too far away.
It is hard to answer this one without "Making statements based on opinion", but it's one worth giving partially backed up opinions on to hopefully save others some time and frustration.
My opinion is that it's just not ready. I unfortunately have an app in the wild at the moment based around CoreData + iCloud and even though we danced around a number of iCloud bugs to finally get it stable enough to pass reasonably thorough testing some users are still running into the corrupted sync states. I've spent a healthy portion of my recent life trying to make it work and am currently reluctantly reimplementing the app without Core Data. I really hope that it stabilizes soon as I genuinely like most of it.

Resources