download recipe from QR code url

13 views
Skip to first unread message

Roberto

unread,
Aug 8, 2009, 2:14:26 PM8/8/09
to Bites
would be possible to scan QR code url from website to download a
recipe?

I want to share some recipes, and i dreamed with users scaning QR
codes with the recipes that they like.

I tryed with Barcode Scanner linking directly to xml file, but I only
can open in browser and i dont know how to save/install easy.

This feature can make this app really powerful and make Bites comunity
grow.

Ben Caldwell

unread,
Aug 8, 2009, 6:52:37 PM8/8/09
to Bites
This is already possible, just encode the url of your recipe file at
http://zxing.appspot.com/generator/.

I have encoded http://sites.google.com/site/caldwellcode/Home/recipes/ChickpeaPatties.xml
with the zxing generator and when I scan this the phone browser opens
Bites to import the recipe in the usual way.
I will put the qr code on my recipes page so you can try it out -
http://sites.google.com/site/caldwellcode/Home/recipes

Roberto

unread,
Aug 8, 2009, 7:37:43 PM8/8/09
to Bites
I will check my server.

Now its displaying the xml file, and not giving me the save as option.

I think i can fix it to give me the chance of downloading the xml file
to disk. (maybe changing the content type headers)

Your link (and QR) worked fine. This rocks! :)

On 9 ago, 00:52, Ben Caldwell <benny.caldw...@gmail.com> wrote:
> This is already possible, just encode the url of your recipe file athttp://zxing.appspot.com/generator/.
>
> I have encodedhttp://sites.google.com/site/caldwellcode/Home/recipes/ChickpeaPattie...
> with the zxing generator and when I scan this the phone browser opens
> Bites to import the recipe in the usual way.
> I will put the qr code on my recipes page so you can try it out -http://sites.google.com/site/caldwellcode/Home/recipes

Roberto

unread,
Aug 8, 2009, 8:59:13 PM8/8/09
to Bites
I fixed it in my .htaccess file adding the line:

AddType application/octet-stream .xml

This make the xml files downloadable in apache.

Ben Caldwell

unread,
Aug 8, 2009, 10:41:29 PM8/8/09
to Bites
Cool, you have to send me a link to your recipe site when it is ready!

If it helps, I use a "text/xml" mime-type filter to open Bites as this
is what google sites was serving my recipe.xml files as. I read
somewhere that this mime-type is being deprecated in favour of
"application/xml" but I'll just use whatever works.

I don't know much about apache and mime-types so if you have any ideas
about ways to serve recipe.xml files let me know and I'll try them
out.

Roberto

unread,
Aug 9, 2009, 2:31:20 AM8/9/09
to Bites
On 9 ago, 04:41, Ben Caldwell <benny.caldw...@gmail.com> wrote:
> Cool, you have to send me a link to your recipe site when it is ready!

Yes, I will do. Im thinking about how to do a simple "reciper".. now i
have to choose between a CMS like Interactive Tools CMS Builder or try
with php+codeigniter (maybe more custom).

> If it helps, I use a "text/xml" mime-type filter to open Bites as this
> is what google sites was serving my recipe.xml files as. I read
> somewhere that this mime-type is being deprecated in favour of
> "application/xml" but I'll just use whatever works.

I found a nice article here: http://www.boutell.com/newfaq/creating/forcedownload.html

Needs php to force the server sending xml as atachment.

If there is no php choice, creating the .htaccess file should be fine.
Maybe easy for people with free hostings because they will not have
access to apache config files.

Your mime choice can be set with: AddType text/xml xml in the
directory where xml are stored. Same way, with the .htaccess

>
> I don't know much about apache and mime-types so if you have any ideas
> about ways to serve recipe.xml files let me know and I'll try them
> out.

Looks like very discussed topic in forums... Some choices as compress
zip recipe files is good with PC/Mac users, but not with androids.

Roberto

unread,
Aug 9, 2009, 4:18:16 PM8/9/09
to Bites
Im still trying with headers.

<?php
header('Content-Type: text/xml; charset=UTF-8');
header('Content-Disposition: attachment; filename=recipes.xml');
header('X-Content-Type-Options: nosniff');
readfile('recipes.xml');
?>

When i download xml files, they look like "not asociated" to any app.

I have to open Astro o Androzip filemanager and open from there
directly.

Tomorrow ill try again from office, and write my results if any.

I installed httpfox firefox addon to compare http headers, my htc
magic its full of apps and maybe i had to check with a fresh reset
(just lazy) ^_^

Ben Caldwell

unread,
Aug 9, 2009, 9:36:50 PM8/9/09
to Bites
I just read the article you linked to on forcing downloading in php.
Very interesting, I had been wondering recently if it was possible to
mark a link as download only and this shows it is.

I haven't found this method necessary when using my phone browser.
When the link to the xml file is clicked, the browser creates an
intent to view the xml file which is caught by the Bites intent filter
and then imported.

I have been thinking about how to create a central recipe website
recently. One of the things I think should happen is different display
depending on the viewing device - i.e. phone or pc browser. I think
this can be done with css media types, an example at
http://htmldog.com/test/handheld.html

When viewing from a phone the site displays links to recipe.xml files
to click on and import.
When viewing from a pc the site displays a QR code containing a link
to the recipe.xml file that can be scanned with a phone to download.

Roberto

unread,
Aug 10, 2009, 8:08:32 AM8/10/09
to Bites
Im trying diferent config files.

Please, could you take a look at http://www.segurosporcar.com/recipes/
?

First 3 configs work for me.

3rd one, using php to serve the file still dont works smooth.. its
serving xml contents but filename is wrong. However, headers are quite
the same as your link in google sites.

Good idea about having two diferent sites, desktop and mobile. I miss
to have some photo of the recipe in phone of website too.

Ben Caldwell

unread,
Aug 11, 2009, 7:57:27 AM8/11/09
to Bites
I had a look at segurosporcar - I got the same results as you have
tabulated there.

I will try and tweak my intent filter to see if I can get the
application/xml one (7th down) to work as well.

On Aug 10, 8:08 pm, Roberto <roberto.por...@gmail.com> wrote:
> Im trying diferent config files.
>
> Please, could you take a look athttp://www.segurosporcar.com/recipes/

Ben Caldwell

unread,
Aug 11, 2009, 8:19:06 AM8/11/09
to Bites
I've added "application/xml" to my intent filter - now the 8th one
down works (application/xml, content-disposition:attachment). It
downloads as a .php file but still has the correct application/xml
mime-type to open in Bites.

I'll include both mime-types types (application/xml and text/xml) in
my next release to make Bites work with more configurations. Let me
know if you have any other ideas you want to try.
> > to have some photo of the recipe in phone of website too.- Hide quoted text -
>
> - Show quoted text -

Roberto

unread,
Aug 11, 2009, 9:10:00 AM8/11/09
to Bites
Looks like a problem with android explorer, because when i try with
firefox works fine.

Today i did small script to convert simple txt file to xml, and im
trying to do a receipt searcher (google style).

I think it will be usefull a description field in the xml file for
recipes, sometimes recipe name can be "too much fashion" and user dont
get idea about what is cooking here.

still not uploaded to server, ill send you link when its done.

http://www.segurosporcar.com/recipes/recipe1.jpg (you can see
description in green)
http://www.segurosporcar.com/recipes/recipe2.jpg

still looks simple but no more time today. Im using zoom search engine
(i have enterprise license at work).

Ben Caldwell

unread,
Aug 11, 2009, 9:25:59 PM8/11/09
to Bites
I'll add the description as an attribute of the recipe element in my
xml file, the next release of Bites will use this.

I've also had requests to include images of recipes, this would be a
bit more difficult. I think I will need to add a url to the xml file
that points to an image file. Bites would have to parse this and
download the image file. This feature will probably have to wait for a
later release.

Just an idea regarding files downloaded with .php extension - did you
try double quotes around the filename in your content-disposition?

header('Content-Disposition: attachment; filename="Chickpea.xml"')


On Aug 11, 9:10 pm, Roberto <roberto.por...@gmail.com> wrote:
> Looks like a problem with android explorer, because when i try with
> firefox works fine.
>
> Today i did small script to convert simple txt file to xml, and im
> trying to do a receipt searcher (google style).
>
> I think it will be usefull a description field in the xml file for
> recipes, sometimes recipe name can be "too much fashion" and user dont
> get idea about what is cooking here.
>
> still not uploaded to server, ill send you link when its done.
>
> http://www.segurosporcar.com/recipes/recipe1.jpg(you can see
> description in green)http://www.segurosporcar.com/recipes/recipe2.jpg

Roberto

unread,
Aug 12, 2009, 5:40:42 AM8/12/09
to Bites

On 12 ago, 03:25, Ben Caldwell <benny.caldw...@gmail.com> wrote:
> I'll add the description as an attribute of the recipe element in my
> xml file, the next release of Bites will use this.

great!

> I've also had requests to include images of recipes, this would be a
> bit more difficult. I think I will need to add a url to the xml file
> that points to an image file. Bites would have to parse this and
> download the image file. This feature will probably have to wait for a
> later release.

I dont know how to handle images, maybe can asociate as an url:
- to recipe: final image
- to ingredient: photo ingredient
- to method: showing some step of the recipe

But this will be a lot of hardcoding ... maybe can keep it simple at
first.

>
> Just an idea regarding files downloaded with .php extension - did you
> try double quotes around the filename in your content-disposition?
>
> header('Content-Disposition: attachment; filename="Chickpea.xml"')

I tryed this, maybe this solve problems with spaces. But filename
sould be urlencoded for avoid problems with languages too.

Roberto

unread,
Aug 13, 2009, 8:25:44 AM8/13/09
to Bites
Today I tested characters like á, ñ and so. Saving files as UTF-8 in
txt editor, with UNIX-LF end of line all works fine. Tested with email
and sms in Bites.

Small recipes website working at: http://nusk.com/bites/search.php

To get some results write "sal" word, without quotes.

Still testing there.

Some extra fields that im using at this time are:

description - to give an idea about what is cooking in each recipe
image - to handle image of the recipe
qrimage - to handle qr image linked to xml file
keywords - to improve searches with words not included in the recipe,
like "pasta" in macarroni recipe.

Ben Caldwell

unread,
Aug 13, 2009, 9:16:08 AM8/13/09
to Bites
This is great! I just tried it out and it works exactly like I
imagined.

I've been experimenting with css to change the way a page is served
for a mobile browsers. From my css file:

@media handheld, only screen and (max-device-width: 480px) {

/*anthing tagged with this class won't display on a handheld device*/
.nomobile{display:none;}

body{
background-color:black;
color:white;
}
}

Just some ideas, this renders with a black background and white text
on my phone browser. QR code images can be tagged with
class="nomobile" so they don't show on the phone browser too.

Roberto

unread,
Aug 14, 2009, 7:21:30 AM8/14/09
to Bites
css tag works fine.

i optimized the html to fit in android screen (vertical and
horizontal)

now QR is hidden with android.
Reply all
Reply to author
Forward
0 new messages