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
def get_subgrids(three_rows): | |
""" splits given set of three rows into subgrids""" | |
return zip(*[(row[0:3], row[3:6], row[6:]) for row in three_rows]) | |
def check_sudoku(sudoku): | |
try: | |
def check_row(row): | |
""" checks that the row contains 1 and only 1 element from 1 to 9 and | |
that the total count == 9""" | |
counts = [0 for x in range(10)] | |
for i in range(9): |
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
Traceback (most recent call last): | |
File "/home/drew/.virtualenvs/petal/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__ | |
return self.wsgi_app(environ, start_response) | |
File "/home/drew/.virtualenvs/petal/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app | |
response = self.make_response(self.handle_exception(e)) | |
File "/home/drew/.virtualenvs/petal/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app | |
response = self.full_dispatch_request() | |
File "/home/drew/.virtualenvs/petal/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request | |
rv = self.handle_user_exception(e) | |
File "/home/drew/.virtualenvs/petal/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request |
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
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' | |
db = SQLAlchemy(app) |
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
from petalapp import db | |
ROLE_USER = 0 | |
ROLE_ADMIN = 1 | |
class User(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String(80)) | |
email = db.Column(db.String(150), unique=True) | |
role = db.Column(db.SmallInteger, default=ROLE_USER) |
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
#include <iostream> | |
#include <string> | |
using namespace std; | |
class personType | |
{ | |
public: | |
void print() const; |
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
26.cpp|30 col 6 error| ‘template<class type> class strange’ used without template parameters | |
26.cpp|30 col 32 error| invalid use of template-name ‘strange’ without an argument list | |
26.cpp|30 col 41 error| ISO C++ forbids declaration of ‘rightObject’ with no type [-fpermissive] | |
26.cpp|30 col 52 error| ‘bool operator==(const int&)’ must have an argument of class or enumerated type | |
//a.Write a statement that declares sObj to be an object of type strange | |
//such that the private member variables a and b are of type int. | |
//b. Write a statement that shows the declaration in the class strange to |
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
def download_s3(file_title): | |
s3conn = boto.connect_s3(app.config["AWS_ACCESS_KEY_ID"],app.config["AWS_SECRET_ACCESS_KEY"]) | |
bucket = s3conn.get_bucket(app.config["S3_BUCKET"]) | |
key = bucket.get_key(file_title) | |
seconds = 60*5 | |
url = key.generate_url(expires_in=seconds) | |
return url | |
# then | |
# g.url = download_s3('some_title') |
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
2013-01-09T21:35:29+00:00 heroku[deployhooks]: Notified New Relic about the deploy | |
2013-01-09T21:35:34+00:00 heroku[web.1]: Starting process with command `newrelic-admin run-program gunicorn -b "0.0.0.0:55287" -w 3 runserver:app ` | |
2013-01-09T21:35:37+00:00 app[web.1]: 2013-01-09 21:35:37 [2] [INFO] Starting gunicorn 0.15.0 | |
2013-01-09T21:35:37+00:00 app[web.1]: 2013-01-09 21:35:37 [2] [INFO] Listening at: http://0.0.0.0:55287 (2) | |
2013-01-09T21:35:37+00:00 app[web.1]: 2013-01-09 21:35:37 [2] [INFO] Using worker: sync | |
2013-01-09T21:35:37+00:00 app[web.1]: 2013-01-09 21:35:37 [5] [INFO] Booting worker with pid: 5 | |
2013-01-09T21:35:37+00:00 app[web.1]: 2013-01-09 21:35:37 [6] [INFO] Booting worker with pid: 6 | |
2013-01-09T21:35:37+00:00 app[web.1]: 2013-01-09 21:35:37 [7] [INFO] Booting worker with pid: 7 | |
2013-01-09T21:35:42+00:00 heroku[web.1]: State changed from starting to up | |
2013-01-09T21:37:10+00:00 heroku[slugc]: Slug compilation started |
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 SurveySection(db.Model): | |
""" | |
Survey_section has a one-to-many relationship with User_survey_section | |
""" | |
id = db.Column(db.Integer, primary_key=True) | |
user_survey_sections = db.relationship('User_survey_section', backref="survey_section", | |
lazy='dynamic') | |
name = db.Column(db.String(45)) |
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
#include "Text.h" | |
// ************************************************************** | |
// Name : Drew Verlee | |
// Acess ID : fd4544 | |
// Assign : lab01 | |
// ************************************************************** | |
Text::Text ( const char *charSeq) |
OlderNewer