creating a dynamically expanding feed in rails - ruby-on-rails

So what I have in my view atm is just a list of every item in my class. What I want to be able to do is have it only display the first ten or so, and put a button at the bottom that will then load the next ten into the page, and so on. Anyone mind pointing me towards a nice tutorial that will show me how to implement this?

I believe the functionality you are requesting is similar to "infinite scroll", which appends additional results as you scroll towards the bottom the page. You don't really need a button, unless you want to specifically design it this way.
A nice tutorial on infinite scrolling can be found here: https://github.com/amatsuda/kaminari/wiki/How-To:-Create-Infinite-Scrolling-with-jQuery

Related

Pagination for line chart in iOS sdk?

I am using core plot to draw line chart which is showing weekly details of user.
Now what I want is, to swipe next week of graph like scroll view paging functionality (we can also see it on iPhone home screen)
Please refer below image for more details.
Please share any solution or any logic to implement above task.
You can implement this by placing your graph view inside UIScrollView and allowing horizontal scroll. You also may want to enable UIScrollView's pagination feature to achieve "iPhone home screen"-like effect that you're describing.
This part is pretty straightforward, but you may find this StackOverflow answer useful.
However, your performance may suffer if your graph doesn't have reasonable horizontal bounds — i.e if width of your graph is too big to render at one time. You need to test this specifically with your set of data.
If this is indeed the case, one solution is to create separate "reusable" graph views for each week (like reusable UITableViewCells) and render them on-the-fly when user scrolls to the left or to the right. In other words, only render current, next & previous weeks' graphs and update this each time the user flips the page.
P.S. This doesn't relate to your question directly, but you may also want to take a look at JBChartView by Jawbone. I prefer JBChartView over Core Plot because it's really well-written library for creating graphs that you can dig into and customise however you want (unlike from Core Plot which is basically "a black box").

how to make icarousel show items in different order

I use the icarousel class for my project. (This an awesome tool BTW. Thanks to the author.)
I'm trying to reach the following view:
What seems pretty easy. But it is important to keep 2 following items below the current item and just one previously observed by user item on the top. I've reached the similar view pretty easy:
As you can see the order of items is reversed. The view shows one following item below the current item and two previously observed on the top of the view.
Please advise me how to reach effect requested in the first image.
P.S.: Sorry for the links. I do not have enough reputation to post images yet.

Is it possible to show ppt/pptx as aslide show using uidocumentcontroller in IOS?

I have a requirement where i need to present documents like pdf/doc/docx/ppt/pptx on the ipad. Rather than showing the document in one page with vertical scroll, i need to show that as slides moving from left to right ( horizontal swipe ).. Can you tell me how i can accomplish that?
Thanks
The framework does not really offer a way of controlling how things are rendered once you pass the data to it.
Your best bet is to pre-process the files and handle the scrolling yourself by showing each page individually and implementing your own scrolling.

Tracking touch in iOS

I am creating a word search game for the iPhone and am having trouble figuring out what is the best approach to take for the main component of the game (the word search puzzle).
I am currently using a collection view to display the puzzle. However I am having trouble figuring out how to track the users touch on the collection view to highlight letter as they slide their finger across the puzzle.
Iv looked into collection views's selection and highlight features but they don't seem to provide the functionality that I need.
So basically my question are as follows:
Is a collection view the best approach for this type of game (word search)?
If it is, then how do I go about tracking the user input to highlight and return the cells they slide their fingers over?
And if it is not the best approach what are some other options, that make it easier to track users input on a grid like display?
I tired posting images of what I am talking about but can't due so, so hopefully my problem is clear, if not please let me know and I will try to be more specific.
Thank you in advance for any advice and suggestions.
A way to go about this would be to add a pan gesture recognizer to the collection view. Then, you can use indexPathForItemAtPoint: and cellForItemAtIndexPath: to get the correct cell as the user pans. You can then do whatever you want with the individual cells.
There is a great SDK for iOS called HeatMap. You can get more info HERE. I have read lots of good stuff about the developer and the service. Lets you track touch events on selective views.
Here is a screenshot from the demo on that site:

UITableView keep the scroll at the correct position while updating NSFetchedResultsController

I am developing an iOS application that mainly use a UITableView.
It retrieves pages of articles from a server. We have got >25000 articles; so I have implemented a pull-to-refresh and infinite scrolling to travel across the title collection.
The ones downloaded persist using core data; NSFetchedResultsController is used to automatically update the UITableView.
However, I have implemented the infinite scrolling to be in both direction; up and down. Since the user will be allow to scroll down the 25000 article titles, I have to remove the one that the user has already scrolled. If the user scrolls up, I have to re-insert title above the current one.
Doing so, I have got a moving window inside the article collection.
I display my articles by date group using the section and header.
The problem is that because the infinite scrolling goes in both direction, I often delete or add article at a higher position in the table.
Infact to achieve that, I have got to change the predicate associated to NSFetchedResultsController.
This result by scroll being messed up. I have made it jump back to the position where it was supposed to be ish. It is not nice because it is a jump (animation:NO), if I put the animation ON, it goes all around the place before going back to the right position. And the position is not exactly the one it should be.
I am not sure I well explained my problem. I think the problem might be in the way I am using the UITableView but I am not sure how I should use it to make this better.
Cheers
If you only store article titles in Core Data, I think it can handle 25.000 titles.
However I think that the problem you've got is with the pagination of the visible elements of the table
Here is a link that I used to handle something that you requested. You'll have to tweak a little bit to use Core Data and a remote source.
Please post some code if you can so we can have a look.

Resources