<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>A blog from a web launch pad.
From the guys that run: devsArLivemade:
Other blogs from us:sserranomugurm

(we do love freshbooks)


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-15697540-5']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</description><title>Push It to Live!</title><generator>Tumblr (3.0; @pushtolive)</generator><link>http://www.pushittolive.com/</link><item><title>Google maps markers with numbers or text</title><description>&lt;p&gt;This is a quick tip to add markers with numbers or text on demand to a Google Maps map.&lt;/p&gt;



&lt;p&gt;The trick is replace the marker icon with a custom one that has the number/text on it, but the problem is how to do it on demand. Google charts &lt;a title="dynamic icons" target="_blank" href="http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html"&gt;dynamic icons&lt;/a&gt; has a simple interface to do this, by crafting simple urls it renders custom maps like markers. &lt;/p&gt;



&lt;p&gt;Some Examples:&lt;/p&gt;



&lt;p&gt;  http://chart.apis.google.com/chart?chst=d_map_pin_letter&amp;amp;chld=X|ff776b&lt;br/&gt;  http://chart.apis.google.com/chart?chst=d_map_pin_letter&amp;amp;chld=$|ff776b&lt;br/&gt;  http://chart.apis.google.com/chart?chst=d_map_pin_letter&amp;amp;chld=-2|000000|ff0000&lt;br/&gt;  http://chart.apis.google.com/chart?chst=d_map_xpin_icon&amp;amp;chld=pin|bank-dollar|52B552&lt;/p&gt;



&lt;p&gt;&lt;img src="http://chart.apis.google.com/chart?chst=d_map_pin_letter&amp;amp;chld=X%7Cff776b" width="21" height="34"/&gt;&lt;img src="http://chart.apis.google.com/chart?chst=d_map_pin_letter&amp;amp;chld=%24%7Cff776b"/&gt;&lt;img src="http://chart.apis.google.com/chart?chst=d_map_pin_letter&amp;amp;chld=-2%7C000000%7Cff0000" width="21" height="34"/&gt;&lt;img src="http://chart.apis.google.com/chart?chst=d_map_xpin_icon&amp;amp;chld=pin%7Cbank-dollar%7C52B552" width="21" height="34"/&gt;&lt;/p&gt;



&lt;p&gt;Example marker code:&lt;/p&gt;



&lt;pre&gt;var image = 'http://chart.apis.google.com/chart?chst=d_map_xpin_icon&amp;amp;chld=pin|bank-dollar|52B552';&#13;
  var myLatLng = new google.maps.LatLng(-33.890542, 151.274856);&#13;
  var marker = new google.maps.Marker({&#13;
      position: myLatLng,&#13;
      map: map,&#13;
      icon: image&#13;
  });&#13;
&lt;/pre&gt;

&lt;p&gt;&#13;&lt;/p&gt;

&lt;p&gt;You can see a complete example at &lt;a href="http://studio.livemade.com/media/demo/marker.html"&gt;&lt;a href="http://studio.livemade.com/media/demo/marker.html"&gt;http://studio.livemade.com/media/demo/marker.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Have Fun, Sebastián&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;Reference:&lt;/p&gt;



&lt;p&gt;&lt;a href="http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html"&gt;&lt;a href="http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html"&gt;http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;a href="http://code.google.com/apis/maps/documentation/javascript/overlays.html#Icons"&gt;&lt;a href="http://code.google.com/apis/maps/documentation/javascript/overlays.html#Icons"&gt;http://code.google.com/apis/maps/documentation/javascript/overlays.html#Icons&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://www.pushittolive.com/post/1285227235</link><guid>http://www.pushittolive.com/post/1285227235</guid><pubDate>Sun, 10 Oct 2010 14:52:00 -0400</pubDate><category>google maps</category><category>marker with number</category><category>marker with text</category><category>google</category><category>maps</category><category>marker</category><category>geo</category></item><item><title>Facebook login on iphone/phonegap</title><description>&lt;p&gt;This is an approach to login with facebook in a phonegap iphone application, using the ChildBrowser plugin.&lt;/p&gt;



&lt;p&gt;The technique is inspired from the facebook desktop authentication &lt;a href="http://developers.facebook.com/docs/authentication/desktop"&gt;http://developers.facebook.com/docs/authentication/desktop&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Briefly, the application opens a ChildBrowser with the facebook oauth page, setting the redirect_url to a blank page hosted by facebook. After that, every time the browser url changes, it checks if the url is the login success page, then extracts the token from the url to complete the authentication, which is done server side with a python/django service. To the code:&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Install ChildBrowser plugin: &lt;/strong&gt; &lt;/p&gt;



&lt;ul&gt;&lt;li&gt;Download the childbrowser plugin from &lt;a href="http://github.com/purplecabbage/PhoneGap-Plugins"&gt;http://github.com/purplecabbage/PhoneGap-Plugins&lt;/a&gt;&lt;/li&gt;&#13;
&lt;li&gt;Install it, drag and drop the files under ChildBrowser/iPhone/ to the plugins folder on your xcode project; this should do the trick.&lt;/li&gt;&#13;
&lt;li&gt;Put the file ChildBrowser.js inside the www folder&lt;/li&gt;&#13;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;The html and js part:&lt;/strong&gt;&lt;/p&gt;



&lt;ul&gt;&lt;li&gt;Include the ChildBrowser.js in the head of the index.html file after the phonegap.js&lt;/li&gt;&#13;
&lt;/ul&gt;&lt;pre&gt;...&#13;
&amp;lt;script src="phonegap.js" type="application/x-javascript" charset="utf-8"&amp;gt;&amp;lt;/script&amp;gt;&#13;
&amp;lt;script src="ChildBrowser.js" type="application/x-javascript" charset="utf-8"&amp;gt;&amp;lt;/script&amp;gt;&#13;
...&#13;
&lt;/pre&gt;

&lt;p&gt;&#13;&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Add facebook login button that fires onPubFacebookBtn(), something like&amp;#160;:&lt;/li&gt;&#13;
&lt;/ul&gt;&lt;pre&gt;&amp;lt;a href="onPubFacebookBtn()"&amp;gt;facebook login&amp;lt;/a&amp;gt;&#13;
&lt;/pre&gt;



&lt;ul&gt;&lt;li&gt;Add the following js code (&lt;strong&gt;the interesting part&lt;/strong&gt;):&lt;/li&gt;&#13;
&lt;/ul&gt;&lt;pre&gt;&amp;lt;script type="application/x-javascript" charset="utf-8"&amp;gt;&#13;
    function onPubFacebookBtn(){ &#13;
        /* On Facebook Login */&#13;
        var my_client_id  = "REPLACE_WITH_YOUR_FACEBOOK_APP_ID",&#13;
        my_redirect_uri   = "http://www.facebook.com/connect/login_success.html",&#13;
        my_type           = "user_agent",&#13;
        my_display        = "touch"&#13;
&#13;
        var authorize_url  = "https://graph.facebook.com/oauth/authorize?";&#13;
        authorize_url += "client_id="+my_client_id;&#13;
        authorize_url += "&amp;amp;redirect_uri="+my_redirect_uri;&#13;
        authorize_url += "&amp;amp;display="+my_display;&#13;
        authorize_url += "&amp;amp;scope=publish_stream"&#13;
&#13;
        client_browser = ChildBrowser.install(); &#13;
        client_browser.onLocationChange = function(loc){ facebookLocChanged(loc); };&#13;
        if(client_browser != null) {  window.plugins.childBrowser.showWebPage(authorize_url); }&#13;
    }&#13;
&#13;
    function facebookLocChanged(loc){&#13;
       /* Here we check if the url is the login success */&#13;
       if (/login_success/.test(loc)) { &#13;
           var fbCode = loc.match(/code=(.*)$/)[1]&#13;
           /* I complete the login server side, but you could use the facebook js sdk */&#13;
           $.ajax({&#13;
              url: 'http://localhost:8000/api/login/facebook/', &#13;
              dataType: 'jsonp',&#13;
              type: 'GET',&#13;
              data: {code: fbCode},&#13;
              success: function(data, textStatus) {&#13;
                  if (data['success']) {&#13;
                    localStorage.facebook_token = data['token']; /* store the token */&#13;
                    client_browser.close();&#13;
                    jQT.goTo('#home');&#13;
                  } else {&#13;
                      client_browser.close();&#13;
                  }&#13;
              },&#13;
              error: function(XMLHttpRequest, textStatus, errorThrown) {&#13;
                  alert(textStatus);&#13;
                  jQT.goTo('#home');&#13;
              }&#13;
           });&#13;
       }&#13;
    }&#13;
&#13;
&#13;
&amp;lt;/script&amp;gt;&#13;
&lt;/pre&gt;

&lt;p&gt;&#13;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span&gt;Python/Django service side code:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;



&lt;pre&gt;import urllib&#13;
import cgi&#13;
&#13;
from django.utils import simplejson&#13;
&#13;
def json_response(params, data):&#13;
    """&#13;
        Helper to handle JSON/JSONP calls&#13;
    """&#13;
    data = simplejson.dumps(data)&#13;
    if params.has_key('callback'):&#13;
        response = "%s(%s)" % (params['callback'], data)&#13;
        return HttpResponse(response, mimetype="application/javascript")&#13;
    return HttpResponse(data)&#13;
&#13;
def login_facebook(request):&#13;
    try:&#13;
        code = urllib.unquote(request.GET['code']).replace("%7C", "|")&#13;
    except KeyError:&#13;
        return json_response(request.GET, {'success': False, 'message': 'code is required'})&#13;
&#13;
    args = {&#13;
        "client_id": FACEBOOK_API_ID,&#13;
        "client_secret": FACEBOOK_API_SECRET,&#13;
        "redirect_uri": "http://www.facebook.com/connect/login_success.html",&#13;
        "code": code&#13;
    }&#13;
    args = urllib.urlencode(args)&#13;
    response = urllib.urlopen("https://graph.facebook.com/oauth/access_token?%s" % args).read()&#13;
    response = cgi.parse_qs(response)&#13;
    access_token = response["access_token"][-1]&#13;
&#13;
    # Download the user profile&#13;
    args = urllib.urlencode(dict(access_token=access_token)&#13;
    profile = simplejson.load(urllib.urlopen("https://graph.facebook.com/me?%s" % args)))&#13;
    &#13;
    return json_response(request.GET, {'success': True, 'token': access_token, 'profile': profile})&#13;
&lt;/pre&gt;

&lt;p&gt;&#13;&lt;/p&gt;

&lt;p&gt;Cheers, Sebastian Serrano&lt;/p&gt;</description><link>http://www.pushittolive.com/post/1239874936</link><guid>http://www.pushittolive.com/post/1239874936</guid><pubDate>Sun, 03 Oct 2010 22:27:00 -0400</pubDate><category>iphone</category><category>phonegap</category><category>facebook</category><category>oauth</category><category>python</category><category>django</category><category>code</category><category>mobile</category></item></channel></rss>

