Skip to content

Instantly share code, notes, and snippets.

View mmahesh's full-sized avatar

Mahesh Chandra Mukkamala mmahesh

View GitHub Profile
Hello World!
@mmahesh
mmahesh / gist:7086151
Created October 21, 2013 15:50
traceback for Programming error
Traceback (most recent call last):
File "/home/hari/venv/lib/python3.3/site-packages/pyramid_debugtoolbar-1.0.8-py3.3.egg/pyramid_debugtoolbar/panels/performance.py", line 55, in resource_timer_handler
result = handler(request)
File "/home/hari/venv/lib/python3.3/site-packages/pyramid_debugtoolbar-1.0.8-py3.3.egg/pyramid_debugtoolbar/panels/performance.py", line 85, in profile_handler
result = self.profiler.runcall(handler, request)
File "/usr/lib/python3.3/cProfile.py", line 144, in runcall
return func(*args, **kw)
File "/home/hari/venv/lib/python3.3/site-packages/pyramid-1.5a2-py3.3.egg/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "/home/hari/venv/lib/python3.3/site-packages/pyramid_tm-0.7-py3.3.egg/pyramid_tm/__init__.py", line 82, in tm_tween
@mmahesh
mmahesh / gist:7096859
Created October 22, 2013 08:06
horus traceback
sqlalchemy.exc.InternalError: (InternalError) (1293, 'Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause') '\nCREATE TABLE user (\n\tactivation_id INTEGER, \n\tregistered_date TIMESTAMP DEFAULT now(), \n\temail VARCHAR(100) NOT NULL, \n\tsecurity_code VARCHAR(256), \n\tpassword VARCHAR(256) NOT NULL, \n\tstatus INTEGER, \n\tusername VARCHAR(30) NOT NULL, \n\tlast_login_date TIMESTAMP DEFAULT now(), \n\tsalt VARCHAR(256) NOT NULL, \n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tPRIMARY KEY (id), \n\tFOREIGN KEY(activation_id) REFERENCES activation (id), \n\tUNIQUE (email), \n\tUNIQUE (security_code), \n\tUNIQUE (username)\n)CHARSET=utf8 ENGINE=InnoDB\n\n' ()
@mmahesh
mmahesh / gist:7098365
Created October 22, 2013 10:31
horus traceback2
#my user model
from datatime import datetime
class User(UserMixin, Base):
last_login_date = Column(DateTime,nullable=False)
registered_date = Column(DateTime, default=datetime.utcnow,nullable=False)
#traceback
@mmahesh
mmahesh / gist:7179381
Created October 27, 2013 08:58
richtext editor not loading
How to load the tinymce using retail rendering i tried adding script in the head for tinymce but tinymce is not showing up
#Schema is as below
class Person(colander.Schema):
name = colander.SchemaNode(
colander.String(),
widget=deform.widget.RichTextWidget(delayed_load=True),)
shoe_size = colander.SchemaNode(
colander.Integer(),
missing = 0,
@mmahesh
mmahesh / gist:7245561
Created October 31, 2013 07:29
models
users_tags_table = Table('users_tags', Base.metadata,
Column('users_id', Integer, ForeignKey('users.id')),
Column('tags_id', Integer, ForeignKey('tags.id'))
)
users_tags_table = Table('users_groups', Base.metadata,
Column('users_id', Integer, ForeignKey('users.id')),
Column('groups_id', Integer, ForeignKey('groups.id'))
)
class Users(Base):
@mmahesh
mmahesh / gist:7479353
Last active May 27, 2023 04:56
Alembic commands
Installation : easy_install alembic or pip install alembic
Changing the dialect of database in alembic.ini to your own local database
In alembic folder change the env.py folder's settings as
from myapp.models import Base
target_metadata = Base.metadata
Now run command : alembic upgrade head
@mmahesh
mmahesh / gist:7498548
Created November 16, 2013 10:23
My html
<!doctype html>
<html ng-app="project" ng-init="users=[&#34;mahesh&#34;, &#34;hari&#34;];;">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-resource.min.js">
</script>
</head>
<body>
<div >
import unittest
def check_in_range(a):
if a>=0 and a<5:
return True
else:
return False
def find_matrix(blocker):
a = [[1,0,1,1,1],[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[1,1,1,0,1]]
if not blocker:
# Views
import logging
logger = logging.getLogger(__name__)
# Settings
LOGGING = {
'version': 1,