Great Hadoop + Spark Tutorial
This great tutorial takes you through installing hadoop and spark to analyze Reddit comment data: Spinning up a Spark cluster, step by step (archived)
This great tutorial takes you through installing hadoop and spark to analyze Reddit comment data: Spinning up a Spark cluster, step by step (archived)
My namenode was not starting because I had the wrong host configured in yarn-site.xml, mapred-site.xml, and core-site.xml.
When you’re running start-dfs.sh on your namenode, ensure the line that says “starting namenode” shows /usr/local/hadoop/logs/hadoop-ubuntu-namenode-<your namenode's hostname>.out in the output. This is how you know your configuration is correct.
You can check your server’s hostname on Ubuntu by running “echo $(hostname)”.
Most people know type() as the one-argument form that tells you an object’s type: type(1) returns <class 'int'>. Called with three arguments, it does something else entirely: it creates a new class at runtime.
type(name, bases, namespace) is equivalent to a class statement. These two produce the same class:
class Foo(object):
pass
Foo = type('Foo', (object,), {})
The arguments are the class name, a tuple of base classes, and a dict of attributes and methods. A function put in that dict becomes a method on the class:
def always_false(self):
return False
Foo = type('Foo', (object,), {'always_false': always_false})
You reach for this when you don’t know the classes you’ll need until runtime, so you can’t write them out ahead of time. The usual example is reflecting an unknown database schema and building a model class for each table on the fly.
I first ran into this in Jeff Knupp’s post “Improve Your Python: Metaclasses and Dynamic Classes With Type.” His blog is no longer up (archived copy). The three-argument type() is documented in the Python docs, and there’s a deeper walkthrough in Python 3 Patterns, Recipes and Idioms.
Note: Unless otherwise stated, this applies to SQLAlchemy 1.0.
Here are a few things I learned while researching the fix for this Flask-Admin Issue #1141:
decimal_return_scale was added to both Float and Numeric in SQLAlchemy 0.9.decimal_return_scale in the SQLAlchemy field, the digits after the decimal place set in decimal_return_scale will show 0’s._default_decimal_return_scale = 10 is only used in a property/method called _effective_decimal_return_scale. The default for decimal_return_scale is “None” and not 10. Since _default_decimal_return_scale and _effective_decimal_return_scale start with an underscore, so it’s only intended for internal use.decimal_return_scale. It probably should? REAL and DOUBLE have this.db.DECIMAL() will create a numeric(28, 6) in Postgres, but it creates a DECIMAL(10,0) in MySQL. This seemed pretty odd, since the default “scale” is “None”. Maybe it’s just using whatever the default is in each backend.Sources:
Here’s the best blog post I’ve found that talks about the need for deep or shallow copy when using nested dicts in Python:
Great article on detecting duplicate images in Python: Detecting duplicate images in Python (archived)
The first thing you’ll want to do is created a “Hosted Zone” with the same A and CNAME records (and any other relevant records that aren’t specific to GoDaddy).
When you transfer the domain and it asks you if you want to use the old name servers - answer no. I messed this one up and kept using GoDaddy’s “domaincontrol.com” name servers and DNS stopped resolving eventually. If you mess this up too, you’ll need to go to the “Hosted Zone” for your site and copy the records in the “NS” list to domain’s name servers on the registered domains page.
Finally decided to put all the interesting ETL software I find into a list: https://github.com/pawl/awesome-etl
Here’s a great page describing Python idioms: https://david.goodger.org/projects/pycon/2007/idiomatic/handout.html
This gist of a Raymond Hettinger talk is also great: https://gist.github.com/JeffPaine/6213790
It’s a short guide, but I think it covers everything a beginner needs to know.