This file contains 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
# print a user's tweets | |
import simplejson | |
import re | |
import urllib2 | |
import string | |
me = urllib2.urlopen('http://twitter.com/statuses/user_timeline/peteskomoroch.json?count=200') | |
for tweet in simplejson.loads(me.read()): | |
print tweet['text'].encode('utf-8') |
This file contains 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
# poll a search term every 60 seconds and print tweets out | |
import time | |
import simplejson | |
import re | |
import urllib2 | |
import urllib | |
last_id = False | |
while True: |
This file contains 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 java.util.Timer; | |
import java.util.TimerTask; | |
import javax.microedition.location.Criteria; | |
import javax.microedition.location.Location; | |
import javax.microedition.location.LocationException; | |
import javax.microedition.location.LocationListener; | |
import javax.microedition.location.LocationProvider; | |
import javax.microedition.location.QualifiedCoordinates; |
This file contains 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 net.rim.device.api.crypto.SHA1Digest; | |
import net.rim.device.api.system.Bitmap; | |
import net.rim.device.api.system.CodeSigningKey; | |
import net.rim.device.api.system.ControlledAccess; | |
import net.rim.device.api.system.PersistentObject; | |
import net.rim.device.api.system.PersistentStore; | |
import net.rim.device.api.ui.Manager; | |
import net.rim.device.api.ui.Screen; | |
import net.rim.device.api.ui.Ui; | |
import net.rim.device.api.ui.UiEngine; |
This file contains 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 java.util.Timer; | |
import java.util.TimerTask; | |
import javax.microedition.location.Criteria; | |
import javax.microedition.location.Location; | |
import javax.microedition.location.LocationListener; | |
import javax.microedition.location.LocationProvider; | |
import javax.microedition.location.QualifiedCoordinates; | |
public class LocationTracker extends TimerTask { |
This file contains 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 java.io.InputStream; | |
import javax.microedition.io.Connector; | |
import javax.microedition.io.StreamConnection; | |
public class HTTPClient { | |
public static String getPage(String url) { | |
String response = ""; | |
try { |
This file contains 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; |
This file contains 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 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 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; |
OlderNewer