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
THESE INSTRUCTIONS ARE FOR OLD VERSIONS OF DJANGO/CELERY/PYTHON! | |
1. Download the latest version of django-celery from here: | |
https://github.com/ask/django-celery/archives/master | |
2. Unzip, go to folder | |
3. python setupy.py build | |
4. python setup.py install |
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
/** | |
* | |
* @param x the array of abscissae | |
* @param y the array of ordinates | |
* @return the top elements of the Divided Difference Table used when | |
* calculating Newton's Devided Differences | |
*/ | |
public static double[] aitken(double[] x, double[] y) { | |
int n = x.length; | |
double[] dividedDifferences = y.clone(); |
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
class MyClass: | |
def __init__(self, a_number, **kwargs): | |
self.a_number = a_number | |
for key, value in kwargs.items(): # adding new attributes | |
setattr(self, key, value) | |
if __name__ == "__main__": | |
MY_OBJECT = MyClass(1, a_string = "Hello world!") | |
print MY_OBJECT.a_number, MY_OBJECT.a_string |
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
"""To run this: $ python3 parse.py test.xml | |
The script will pase a XML file and print its node tags. | |
Compatible with Python 3; changing the print statements should make this | |
compatible with Python 2. | |
""" | |
import sys |
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
"""These are my answers for the Embedly Challenge""" | |
from xml.etree import ElementTree | |
from numpy import std # you'll need numpy for Question 2 | |
def question1(): | |
def digitSum(x): | |
# pretty ugly, eh? | |
return sum(map(int, list(str(x)))) | |
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
"""Some Python code to illustrate the 'issue' noticed in JavaScript here: | |
http://stackoverflow.com/questions/9381321/a-function-is-larger-than-an-array | |
This will work on Python 2.x; in Python 3.x you would get: | |
TypeError: unorderable types: list() > function() | |
""" | |
l1 = [] | |
def f(): |
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
# A funny thing about Python: http://hatepaste.com/paste/6c7e1a3c | |
True = False | |
if True: | |
print "ORLY?" | |
else: | |
print "YARLY!" | |
# BUT, this will work only in Python 2.x; in Python 3.x you will get | |
# "SyntaxError: assignment to keyword" at line 2 |
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
""" | |
This brief script demonstrates a frequent mistake in Python related | |
to the different ways of copying objects. | |
References: | |
1. Personal experience | |
2. http://stackoverflow.com/questions/2196956/add-an-object-to-an-array-python | |
""" | |
import copy # http://docs.python.org/library/copy.html |
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
For compiling LaTeX documents (with BibTex support) we basically have two options: | |
LaTeX - will produce a DVI file: | |
latex -interaction=nonstopmode -shell-escape %.tex|bibtex %.aux|latex -interaction=nonstopmode -shell-escape %.tex|latex -interaction=nonstopmode -shell-escape %.tex|"C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/yap.exe" %.dvi | |
PdfLaTeX: | |
pdflatex --shell-escape --enable-write18 -synctex=1 -interaction=nonstopmode %.tex|bibtex %.aux|pdflatex --shell-escape --enable-write18 -synctex=1 -interaction=nonstopmode %.tex|pdflatex --shell-escape --enable-write18 -synctex=1 -interaction=nonstopmode %.tex|"C:/Program Files (x86)/Adobe/Reader 11.0/Reader/AcroRd32.exe" %.pdf | |
These commands are tailored for Texmaker (Win) and will open the approiate preview application after compiling the documents. | |
Also, (E)PS file support is included; to make sure such images will be correctly displayed, add the following to your LaTeX source preamble: |
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
This work-in-progress summarizes the way-too-many BigData(tm) technologies. | |
This is by no means an in-depth description, but a very short summary so that | |
I know where to look. | |
1. Databases: | |
* DynamoDB - aws.amazon.com/dynamodb/ - Amazon AWS integration, MapReduce | |
* MongoDB - mongodb.org/ - JSON-style document database, SQL-like queries + MapReduce | |
* Riak - basho.com/riak/ - Key-Value storage, MapReduce | |
* CouchDB - couchdb.apache.org/ - JSON document storage, JavaScript Queries + MapReduce |
OlderNewer