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 ImageWithThumbnail(models.Model): | |
name = models.CharField(max_length = 255) | |
image = models.ImageField(upload_to=settings.UPLOAD_ROOT,max_length=500,blank=True,null=True) | |
thumbnail = models.ImageField(upload_to=settings.UPLOAD_ROOT,max_length=500,blank=True,null=True) | |
def create_thumbnail(self): | |
# original code for this method came from | |
# http://snipt.net/danfreak/generate-thumbnails-in-django-with-pil/ |
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
/* =================================================== | |
* jQuery SelectAll plugin | |
* =================================================== | |
* @author: https://gist.github.com/Leegorous | |
* @license: Licensed under the Apache License, Version 2.0 (the "License"), | |
* see http://www.apache.org/licenses/LICENSE-2.0 | |
* =================================================== | |
* | |
* Example: | |
* |
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
<html> | |
<head> | |
<title>Testing</title> | |
<script language="javascript"> | |
fields = 1; | |
function addInput() { | |
if (fields < 4) { | |
document.getElementById('text').innerHTML += "<input type='file'"+ "name=" + "thumdals" + fields + " value=''/><br />"; | |
fields += 1; | |
} else { |
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
#Hadoop 2.6.0 Multinode cluster Setup | |
From Blog http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-multi-node-cluster/ | |
###Machine 1(master). | |
Prequisite: | |
java version | |
java -version |
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
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
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
#!/usr/bin/env python | |
import simplejson | |
import logging | |
import random | |
import re | |
import datetime | |
import string | |
import time | |
import sys | |
import urllib |
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
"""Implementation of JSONEncoder | |
""" | |
from __future__ import absolute_import | |
import re | |
from operator import itemgetter | |
from decimal import Decimal | |
from .compat import u, unichr, binary_type, string_types, integer_types, PY3 | |
def _import_speedups(): | |
try: | |
from . import _speedups |
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 json, psycopg2 | |
vcap_services = json.loads(os.environ['VCAP_SERVICES']) | |
postgres_srv = vcap_services['postgresql-9.1'][0] | |
try: | |
cred = postgres_srv['credentials'] | |
except KeyError,ke: | |
print >> sys.stderr, "VCAP_SERVICES = %s" % str(vcap_services) | |
raise ke | |
DATABASES = { |
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
#!/usr/bin/env python | |
import smtplib | |
import sys | |
from optparse import OptionParser | |
def initialize_smtp_server(smtpserver, smtpport, email, pwd): | |
''' | |
This function initializes and greets the SMTP server. | |
It logs in using the provided credentials and returns the |
OlderNewer