How iOS Google Now can show different card template - ios

I wanted to know the technology decision behind the iOS Google app.
As we can see, in the app's Google Now feature it renders many different card templates for different scenarios, and those templates seems to be very flexible based on server inputs.
I was wondering if this is implemented all based on HTML5? or they just have many templates built in and render them locally? I'd vote for the HTML5 route but not sure if this still involved some native code to make it more responsive?
Thanks!

As we (well, most of the community) are not Google employees we can't tell you what they really did, but I'd say that it is possible to do this dynamically in the app.
We did develop something similar that responds to definitions sent by the server and transforms them to custom designed forms following basic rules.
Google reuses the design of those cards for different plattforms, the easiest solution should be showing some WebView and using HTML5.

I agree with Kevin, as this answer is entirely based on personal opinion, too.
The way I would go is to create a card class which will load some JSON data and format it with HTML and CSS. Looking at each card it would be hell to format things that way natively. I mean, attributed strings is not the way to go. Too much logic for deciding which card get a bigger text or a picture.
Additionally, the top header is most likely "localized" as well, so you get the location and load a localized image. But that is Google by nature.

Related

iOS: Create dynamic contracts with iOS

I want to create a native ios application where people have to sign different contracts. Each contract contains text and input fields such as drop down and textbox. Now each contract might have different number of input fields and these might be totally different.
Any input in the best way to solve this problem? It seems like a lot of work to dynamically generate UI in code and reformat the contracts in a way that can be rendered by ios? As I cant send the pdf or doc itself.
One solution may be you can have categories(sector-1,sector-2 etc) and related sample contract from. In those sample forms you can handle dynamic controls which definitely a few.

Stop part of page being index by search engines?

How can I stop search engines indexing part of my page? Is there an HTML5 element for this?
Its just a line of text that I want to hide (a co-worker doesnt want their name on google for some reason). Im thinking that I could inject the text with javascript, but I have heard google does sometimes look inside javascript files.
I also thought of using images instead of text, but im concerned how this will look cross device and platform. Ive noted text rendering can differ on mac and pc and thats before ive had to think about mobile devices, retina displays, etc.
Thanks
You can't hide content unless you use the methods you've already outlined above. Your best bet is to use JavaScript in an external file and then block that file using robots.txt.

What's a good way to "standardize" the format of web content for importing into an app?

I'm working on a project where one of the requirements is to import articles from a website. The problem is that different websites have different formats. I could theoretically write some code that strips out extra content from known websites, but this is hardly maintainable. It sounds like there should be something already out there that can "RSS-ify" pages for me into some format, so that I can easily import content.
Is there such a service that I can just "plug" any website into? Also, what are my options here in regards to importing web content into an app, aside from this? How would you handle it?
Edit: Two things that come to mind are FeedBurner and Apple's Safari browser, which adds an "RSS" button. (Safari Mobile actually does one better and renders a neat read view in iOS 5.) Are they relevant to this question in any way?
It seems that there is none. The best I can do is work with content providers to offer RSS feeds and such.

translate to multiple languages

I would like to get translation from one ( best - automatically detected) language to 4 different using google-translate. My idea is to wrote a html document which contain 4 frames - in one of them I can find text form and button. After click on it, Internet browser will send demand to google translate and show results in 4 frames.
If you want a self service, hosted service that does translations and content management for you check out Localize.js
This is going to be terribly translated. As someone that speaks English well, Russian poorly, and Spanish even more poorly, I can detect that these auto-translations never come out right.
My recommendation is to serve your page through a basic system that will allow you to respond to submitted form values. Pass in &LANG=two country iso code and then have your backend serve up the correct data.
Have someone that speaks both languages prepare the content for you. Then, whenever you are serving these pages, you can also conditionally adjust CSS to account for differences in format which come from difference in language length.
If you don't have those capabilities available, make 5 pages. One in English and the other 4 in the other languages. You will seriously seem retarded to anyone that speaks those languages well if you use an auto-translate. I think this is a bad idea for any kind of professional page, even if you can work out the technical issues.
-Brian J. Stinar-
Google has an API to its translate tool that will enable you to send it some text and receive back that text translated into any language you choose.
edit: This is now a paid service

Rails Sanitize: Safety + Allowing Embeds

We're building a user generated content site where we want to allow users to be able to embed things like videos, slideshares, etc... Can anyone recommend a generally accepted list of tags / attributes to allow in rails sanitize that will give us pretty good security, while still allowing a good amount of the embedable content / html formatting?
As long as is turned off, you should be able to allow objects. You might even be able to to define the actual acceptable parameters of object tags, so that you only allow a whitelist, and abitrary objects cannot be included.
However, it may be better to provide some UI support for embedding. For example, I prompt the user for a YouTube URL and then derive the embed code for the video from that.
Several benefits:
- the default YouTube code is not standards compliant so I can construct my own Object code
- I have complete control over the way embedded elements are included in the output page
Honestly saying allowing users to use WYSIWYG Html editors might sound good, but in practice it just doesn't work well for both users and developers. The reasons are:
Still too different behavior in different browsers.
Whitelist allows to secure site, but users will end up calling and asking to allow another parameter for OBJECT tag or similar. Blacklists are just not secure.
Not many users know what HTML tag is.
For users it is hard to format text (how can you tell them to use HEADER instead of BOLD+FONT-SIZE).
Generally it is pretty painful and you cannot really change the site design if needed because of users did not properly use HTML.
If I would be doing CMS-like system now, I would probably go with semantic markup.
Most users, get used to it quickly and it is just plain text (as here at SO).
Also YOU can generate proper HTML and support needed tags.
For example if you need to embed picture you might write something like:
My Face:image-http://here.there/bla.gif
Which would generate HTML for you like this:
<a class='image-link' title='My Face' href='http://here.there/bla.gif'>
<img alt='My Face' src='http://here.there/bla.gif' />
</a>
There are plenty of markup languages around, so just pick the one is more appropriate to you and add your own modifications.
For example, GitHub uses modified markdown and the code to parse it is just a couple of lines.
One disadvantage is that users need to learn the language and it is NOT WYSIWYG.
Regards,
Dmitriy.
There's a great project for this. It even has embed-analysis to only allow youtube embeds, for example
https://github.com/rgrove/sanitize

Resources