This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <UIKit/UIKit.h> | |
| @interface LoginViewController : UIViewController { | |
| } | |
| - (IBAction) login: (id) sender; | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <body> | |
| <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script> | |
| <script type="text/javascript">FB.init("{{ apikey }}", '/static/xd_receiver.html');</script> | |
| Hello, {{ name }}! | |
| <br/><br/> | |
| <a href="#" onclick="javascript:FB.Connect.logoutAndRedirect('/')">Logout</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <body> | |
| <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"><script> | |
| <script type="text/javascript">FB.init("{{ apikey }}", "/static/xd_receiver.html");</script> | |
| <fb:login-button v="2" onlogin='window.location="/";' size="large">Connect with Facebook</fb:login-button> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import wsgiref.handlers | |
| import os | |
| import facebook | |
| from google.appengine.ext import webapp | |
| from google.appengine.ext.webapp import template | |
| from google.appengine.ext import db | |
| class BaseHandler(webapp.RequestHandler): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def check_connect_session(self, request): | |
| """ | |
| For use in a facebook Connect application running in Google App Engine | |
| Takes a Google App Engine Request | |
| http://code.google.com/appengine/docs/webapp/requestclass.html | |
| and determines if the current user has a valid session | |
| """ | |
| # our session is stored in cookies - validate them | |
| params = self.validate_cookie(request.cookies) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SortReducerByValues { | |
| public static final String INPUT = "/tmp/data_in"; | |
| public static final String OUTPUT = "/tmp/data_out"; | |
| public static void main(String[] args) throws IOException { | |
| new SortReducerByValues().run(); | |
| } | |
| public void run() throws IOException { | |
| JobConf conf = new JobConf(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE newtable AS SELECT * FROM mytable; | |
| STORE mytable INTO '/some_hdfs_folder/newtable' USING PigStorage(','); | |
| DROP TABLE newtable; | |
| RMF /some_hdfs_folder/newtable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT COUNT(*) FROM mytable; | |
| mytable = GROUP mytable ALL; | |
| mytable = FOREACH mytable GENERATE COUNT(mytable); | |
| DUMP mytable; | |
| SELECT COUNT(DISTINCT col1) FROM mytable; | |
| mytable = FOREACH mytable GENERATE col1; | |
| mytable = DISTINCT col1; | |
| mytable = GROUP mytable BY col1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * FROM mytable INNER JOIN othertable ON mytable.col1 = othertable.col1; | |
| mytable = JOIN mytable BY col1, othertable BY col1; | |
| DUMP mytable; | |
| SELECT * FROM mytable LEFT OUTER JOIN othertable ON mytable.col1 = othertable.col1; | |
| mytable = JOIN mytable BY col1 LEFT OUTER, othertable BY col1; | |
| DUMP mytable; | |
| SELECT * FROM mytable RIGHT OUTER JOIN othertable ON mytable.col1 = othertable.col1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * FROM mytable; | |
| DUMP mytable; | |
| SELECT col1, col2 FROM mytable; | |
| mytable = FOREACH mytable GENERATE col1, col2; | |
| DUMP mytable; | |
| SELECT col1 AS new_col1, col2 AS new_col2 FROM mytable; | |
| mytable = FOREACH mytable GENERATE col1 AS new_col1, col2 AS new_col2; |