Python, Passenger phusion and dreamhost

January 22nd, 2012 § 0 comments § permalink

Well, had to setup some stuff on dreamhost. Turns out that they are fairly bad on django hosting. Here is a working passenger_wsgi.py that is possibly much better than the default. Please not that you must have paste [http://pythonpaste.org/]  installed for this to work correctly.

This has python2.7 locally installed in your account, with all the libraries locally. Dreamhost is quite painful, as the documentation is incomplete clearly!

import sys, os
if sys.version < “2.7″: os.execl(“/path/to/python”, “/path/to/ python”, *sys.argv)
sys.stdout = sys.stderr
sys.path.insert(0,”/path/to/Django-1.3.1″)
sys.path.insert(0,”/path/to/project”)
sys.path.append(“/path/to/project root directory”)
os.environ["DJANGO_SETTINGS_MODULE"] = “project.settings”
from paste.exceptions.errormiddleware import ErrorMiddleware
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
def testapplication(environ, start_response):
status = ’200 OK’
output = ‘Hello World! Running Python version ‘ + sys.version + ‘\n\n’
response_headers = [('Content-type', 'text/plain'), ('Content-Length',     str(len(output)))]
start_response(status, response_headers)
return [output]
application = ErrorMiddleware(application, debug=True)

Whats up, world !

January 9th, 2012 § 0 comments § permalink

Wow, that was a long break. Lately not spent any time on writing or thinking, guess that is usually visible in the output ! Need to make it a real habit of writing more and more. Happy new year to anyone who reads this ! Looking forward to kick starting good stuff !

New book : Nginx web server cookbook

May 31st, 2011 § 0 comments § permalink

Nginx web server cookbook

Nginx web server cookbookGuys after a long break, I have come out of my slumber to talk about my first publication with Packt publishing. In short the book is about tips and tricks around the upcoming Nginx web server. You can check it out using this link. This has been published by Packt publishing, a UK based technical publishing house.

It would not have been possible without the tremendous support of the people around me, and in specific the many people I have worked with. I will keep adding more stuff around the book on my blog going ahead.

Nginx 1 Web Server Implementation Cookbook

This is a cookbook full of illustrations and diagrams to help you implement your web needs with Nginx, with a focus on practical examples. If you are tired of Apache consuming all your server memory with little traffic and to overcome this, or for some other reason, you are looking for a high-performance load-balancing proxy server and have tried using Nginx, then this book is for you. You need some basic knowledge of Nginx. System administrators and web developers will benefit greatly from this book.

Using Motorola E6 or A1200 with kannel

December 13th, 2010 § 0 comments § permalink

So for all the people who do not want to learn AT commands to get their old MotoRockr [aka motorola e6] and A1200 working with your kannel setup to send/receive MMS and SMS here is the kannel.conf and modems.conf.

The important part is the modems.conf which has the correct AT commands to receive SMSes.

kannel.conf

#
 
# THIS IS A SAMPLE CONFIGURATION FOR KANNEL
 
#
 
# For any modifications to this file, see Kannel User Guide
 
# If that does not help, send email to users@kannel.org
 
#
 
group = core
 
admin-port = 13000
 
admin-password = bar
 
#status-password = foo
 
#admin-deny-ip = ""
 
#admin-allow-ip = ""
 
#log-file = "/tmp/kannel.log"
 
log-level = 0
 
#access-log = "access.log"
 
#http-proxy-host = "127.0.0.1"
 
#http-proxy-port = 8080
 
#http-proxy-exceptions = "127.0.0.1"
 
#http-proxy-username = "user"
 
#http-proxy-password = "password"
 
#ssl-certkey-file = "mycertandprivkeyfile.pem"
 
smsbox-port = 13001
 
box-allow-ip = "127.0.0.1"
 
# Smsbox related
 
#smsbox-port = 13001
 
#box-deny-ip = "*.*.*.*"
 
#box-allow-ip = "127.0.0.1"
 
#unified-prefix = "00358,0"
 
#white-list = "http://127.0.0.1/white-list.txt"
 
#black-list = "http://127.0.0.1/black-list.txt"
 
#store-file = "kannel.store"
 
# Wapbox related
 
#wapbox-port = 13002
 
#udp-deny-ip = "*.*.*.*"
 
#udp-allow-ip = "127.0.0.1"
 
#wdp-interface-name = "*"
 
# SMSC CONNECTIONS - GLOBAL FIELDS
 
#group = smsc
 
#smsc =
 
#smsc-id = ID
 
#denied-smsc-id = "X;Y"
 
#allowed-smsc-id = "Z"
 
#preferred-smsc-id = "W"
 
#allowed-prefix = "040;050"
 
#denied-prefix = "060;070"
 
#alt-charset =
 
# SMSC Nokia CIMD2
 
#group = smsc
 
#smsc = cimd2
 
#host =
 
#port =
 
#smsc-username =
 
#smsc-password =
 
#keepalive =
 
#sender-prefix =
 
# SMSC EMI
 
#group = smsc
 
#smsc = emi2
 
#smsc = emi_ip to use the old implementation
 
#host =
 
#port =
 
#smsc-username =
 
#smsc-password =
 
#device = /dev/
 
#phone =
 
#our-port =
 
#receive-port =
 
#connect-allow-ip =
 
#keepalive =
 
#flow-control =
 
# SMSC SMPP
 
#group = smsc
 
#smsc = smpp
 
#host =
 
#port =
 
#receive-port =
 
#smsc-username =
 
#smsc-password =
 
#system-type =
 
#address-range =
 
# SMSC SEMA
 
#group = smsc
 
#smsc = sema
 
#device = /dev/tty0
 
#smsc_nua = (X121 smsc address)
 
#home_nua = (x121 radio pad address)
 
#wait_report = 0/1 (0 means false, 1 means true)
 
# SMSC OIS
 
#group = smsc
 
#smsc = ois
 
#host = 103.102.101.100
 
#port = 10000
 
#receive-port = 10000
 
#ois-debug-level = 0
 
# SMSC GSM
 
group = smsc
 
smsc = at
 
modemtype = generic
 
device = /dev/ttyACM0
 
#pin = 2345
 
#validityperiod = 167
 
# SMSC Fake
 
#group = smsc
 
#smsc = fake
 
#host =
 
#port =
 
#connect-allow-ip =
 
# SMSC HTTP
 
#group = smsc
 
#smsc = http
 
#system-type = kannel
 
#send-url =
 
#port =
 
#connect-allow-ip =
 
#username =
 
#password =
 
# SMSBOX SETUP
 
group = smsbox
 
bearerbox-host = localhost
 
sendsms-port = 13013
 
#sendsms-chars = "0123456789 +-"
 
#global-sender = 12345
 
#log-file = "/tmp/smsbox.log"
 
#log-level = 0
 
#access-log = "access.log"
 
#white-list =
 
#black-list =
 
#reply-couldnotfetch =
 
#reply-couldnotrepresent =
 
#reply-requestfailed =
 
#reply-emptymessage =
 
# SEND-SMS USERS
 
group = sendsms-user
 
username = tester
 
password = foobar
 
#user-deny-ip = ""
 
#user-allow-ip = ""
 
# this sender is for Kannel relay testing (http_smsc)
 
group = sendsms-user
 
username = kannel
 
password = rL4y
 
user-deny-ip = "*.*.*.*"
 
user-allow-ip = "127.0.0.1"
 
#name = service_kannel
 
#forced-smsc = ID
 
#default-smsc = ID
 
#faked-sended =
 
#max-messages = 1
 
#concatenation = 1
 
#split-chars =
 
#split-suffix =
 
#omit-empty =
 
#header =
 
#footer =
 
#allowed-prefix =
 
#denied-prefix =
 
#white-list =
 
#black-list =
 
# SMS SERVICES
 
#group = sms-service
 
#name = nothing
 
#keyword = nop
 
#aliases = "noppy;niente"
 
#text = "You asked nothing and I did it!"
 
#get-url = "http://"
 
#post-url = "http://"
 
#file = "/tmp/"
 
#accepted-smsc = ID
 
#allowed-prefix =
 
#denied-prefix =
 
#catch-all = false
 
#send-sender = false
 
#strip-keyword = false
 
#faked-sender =
 
#max-messages = 1
 
#accept-x-kannel-headers = false
 
#assume-plain-text = false
 
#concatenation = false
 
#split-chars =
 
#split-suffix = "+"
 
#omit-empty = true
 
#header =
 
#footer =
 
#prefix =
 
#suffix =
 
#white-list =
 
#black-list =
 
# SMS SERVICE GET-URL EXAMPLE
 
#group = sms-service
 
#keyword = relay
 
#get-url = "http://localhost/service?phone=%p&amp;text=%r&amp;binary=%b&amp;smsc=$i&amp;time=%t
 
# SMS SERVICE black-list
 
#group = sms-service
 
#keyword = black-list
 
#text = "You are not alowed to use this service, Go away!"
 
# SMS SERVICE Default
 
# there should be default always
 
group = sms-service
 
keyword = default
 
get-url = "http://localhost/service/?sender=%p&amp;text=%a"
 
#text = "No service specified"
 
include = "modems.conf"

modems.conf

# If modemtype=auto, try everyone and defaults to this one
 
group = modems
 
id = generic
 
name = "Generic Modem"
 
speed = 460800
 
init-string = "AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0;+CMGF=0;+CNMI=3,2,0,0,0"
 
#init-string="AT+CNMI=2,1,0,1,0;+CMGF=0;+CMEE=1"
 
reset-string = "ATZ"
 
broken = true
 
message-storage = "SM"
 
no-pin = true

Nested comments

August 2nd, 2010 § 0 comments § permalink

Comments inside comments ! That seems to be a basic issue in PHP. Lets say i am including a php file, and i comment it out using /* */ and it super freaks out when that file has comments. Simple things that can save developer pain and i am sure it is not a difficult patch