Jquery mobile best way to store and retrieve data? - jquery-mobile

I'm new on jqm and see a lot of stackoverflow articles but what is the best way to store, pass and retrieve data in JQM ? I don't find example on the jqm site.
Is better to use global object, local storage, ... ?

Thanks to ezanker
See jqmtricks.wordpress.com/2014/01/22/… for passing parameters between pages. It is also no problem to use globals in a single page app. Use localStorage to persist items across sessions.

Related

Display all tweets with a certain hashtag with simple design

I'm developing some website using Rails. I want to add "our users' tweets" part to the main page. I need an advice how I can do it better. I hoped to get standard way to do it, may be some Twitter widget or something else. I used Google, but I've found nothing. Please, point me to the right path. Sorry if my questions is very simple, but I don't really know how to do it. I hope that I needn't parse JSON and add styles independently; I need simple design from Twitter :)
To answer your [ambiguous] question, there are a number of things to consider:
How will you retrieve the tweets?
How will you store / access them?
How will the data be displayed on front-end?
The two methods you have are either to use the Twitter gem, or the TwitterFetcher JS plugin:
Gem
The Twitter gem uses the Twitter API to pull data from the official Twitter API. This means you've got the throttling & authentication to build into your app
The benefits of using this gem is it gives you a HUGE amount of flexibility with the data. You can pull as much data as you need / want, in whatever format you want - all formatted in JSON & can be displayed on your site
This gem is best suited to storing your tweets, either in a DB or in Redis etc, otherwise you'll have massive synchronous dependency on Twitter's API - which is never good for performance
JS
The TwitterFetcher JS plugin is epic - basically takes a Twitter widget & strips out the HTML, allowing you to style it how you like
This is the most effective way to retrieve Twitter data on-the-fly, as it's asynchronous, relies on Twitter's widget system (far more robust than API), and stores no data locally

What's the Best Way to Implement Paging with a List using jQuery Mobile and MVC?

I am building a media library from a tutorial to get up to speed on MVC 4. I did the whole thing and now I'm re-building it using jQuery Mobile. The only piece I've yet to find simple is paging which should be easy. Can someone steer me in the direction of a nice tutorial on the subject?
We do have similar kind of Use case.
Store the Data in Session object in the form of Dictionary in this form.
On click of Next or previous button in Pagination control, fetch data from Controller, bind data to appropriate control in the UI and show data.
Make sure to show only limited data in UI. Restrict the number[max 10 per page]
Format Dictionary

How do I grab meta data from other websites and display on mine in ruby on rails?

When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.
How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.
For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?
Kind regards
I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby
You should likely use a gem like http://nokogiri.org/
It allows you to work with a html page just as you would do with jQuery. Very handy.

ASP.NET (MVC) - Drill down with hash

I'm currently working on a drilldown filter in MVC but I don't really know how to make this the fastest and most flexible as possible.
click here
Now my question is, how do you think they are doing this?
I've really no idea how to make this kind of drilldown but it seems they use some kind of hash they save for quick querying.
Maybe (pseudo)code anyone?
If you're willing to give up a little browser compatibility (it won't work on ancient and some console only browsers but then again neither will anything else), jQuery DataTables is a great way to make drilldowns.
Here is the main site, and Here is a good example of using a dropdown select to filter.
Basically all you have to do is throw all the data into a large <table> and use javascript on the client side to filter. The big benefit is there is no latency when you make a selection, unlike the site you linked.
I think it is not a good idea to put all data on the client side.
It is more reasonable to trust the data filtering to the database server (of couse it depends on your data size).
To speed up receiving the filtered data you can save it in your cache server with hash or select query as tag. Query to cache is faster than to database.
The answer after carefull looking at how they do it:
They send a normal http POST to the server with a querystring of all
choices.
The server sends back a http GET which returns an URL with the
hash.
The server caches the hash with the query so the next time the query is called it is faster.
Thanks everyone for your "usefull" responses.

How to remove HTML5 persistant databases in UIWebView?

I have a native application that uses a UIWebView and notice that with sites like Google, they are using an HTML5 local database for storing information. I am using native APIs for clearing items out of the cookie store, but clearing the persistent cookie store does nothing to remove these local databases. Is there a way to remove them through a native API?
UPDATE:
Is there a way to do this through a non-native API or javascript?
You can run this JavaScript directly in your url bar:
javascript:localStorage.clear();
Note that local storage is same domain scoped, so it will clear the storage
of the current domain that you are.
Currently google uses it for google Analytics, adSense, etc.
You can remove all localstorage variables by using a function like this.
function clearStorage() {
for(var i in localStorage)
{
localStorage.removeItem(i);
}
}
Of course if you need to only get rid of certain variables or simply set them to default values types then this will have to be modified. I am not familiar enough with UIWebView or your use case to know which variables you would want removed.

Resources