Socket.IO

Socket.IO

Connect

 

var io = require(‘socket.io’).listen(80);

io.sockets.on(‘connection’, function (socket) {

socket.on(‘message’, function (data) {
console.log(data);
});
});

  • on message need to parse
  • and on send stringify.

Managing Log Level

 

io.set(‘log level’, 1);

Maintaining connection of same user with socket.io in multiple tab of Browser

 

  • use the same port for both node.js and socket.io server by passing server to listen method of socket.io

References

http://www.danielbaulig.de/socket-ioexpress/
http://stackoverflow.com/questions/8567015/how-to-handle-user-and-socket-pairs-with-node-js-redis

References

Posted in Node.js | Leave a comment

python

Python

Class

__init__(self)

The instantiation operation (“calling” a class object) creates an empty object. Many classes like to create objects with instances customized to a specific initial state. Therefore a class may define a special method named __init__(), like this:
def __init__(self):
self.data = []

When a class defines an __init__() method, class instantiation automatically invokes __init__() for the newly-created class instance. So in this example, a new, initialized instance can be obtained by:

Ref :http://docs.python.org/tutorial/classes.html

Inheritance

class DerivedClassName(BaseClassName):
<statement-1>
.
.
.
<statement-N>

Multiple Inheritance

 

class DerivedClassName(Base1, Base2, Base3):
<statement-1>
.
.
.
<statement-N>

Super

For new-style classes, the method resolution order changes dynamically to support cooperative calls to super(). This approach is known in some other multiple-inheritance languages as call-next-method and is more powerful than the super call found in single-inheritance languages.

*args and **kwargs

Putting *args and/or **kwargs as the last items in your function definition’s argument list allows that function to accept an arbitrary number of anonymous and/or keyword arguments.
For example, if you wanted to write a function that returned the sum of all its arguments, no matter how many you supply, you could write it like this:

def sum(*args):
return sum(args)

It’s probably more commonly used in object-oriented programming, when you’re overriding a function, and want to call the original function with whatever arguments the user passes in.
You don’t actually have to call them args and kwargs, that’s just a convention. It’s the * and ** that do the magic.

class Super( object ):
def __init__( self, this, that ):
self.this = this
self.that = that

class Sub( Super ):
def __init__( self, myStuff, *args, **kw ):
super( Sub, self ).__init__( *args, **kw )
self.myStuff= myStuff

x= Super( 2.7, 3.1 )
y= Sub( “green”, 7, 6 )

This way Sub doesn’t really know (or care) what the superclass initialization is. Should you realize that you need to change the superclass, you can fix things without having to sweat the details in each subclass.

you can also call functions with *mylist and **mydict to unpack positional and keyword arguments:

def foo(a, b, c, d):
print a, b, c, d

l = [0, 1]
d = {“d”:3, “c”:2}

foo(*l, **d)

Will print: 0 1 2 3

http://stackoverflow.com/questions/287085/what-does-args-and-kwargs-mean
http://docs.python.org/tutorial/controlflow.html#more-on-defining-functions

Handling Exceptions

 

while True:
…    try:
…        x = int(raw_input(“Please enter a number: “))
…        break
…    except ValueError:
…        print “Oops!  That was no valid number.  Try again…”
for arg in sys.argv[1:]:
try:
f = open(arg, ‘r’)
except IOError:
print ‘cannot open’, arg
else:
print arg, ‘has’, len(f.readlines()), ‘lines’
f.close()

Raise

The raise statement allows the programmer to force a specified exception to occur. For example:

getattr

http://effbot.org/pyref/getattr.htm

Import

http://effbot.org/zone/import-confusion.htm

__init__.py:

An empty file that tells Python that this directory should be considered a Python package. (Readmore about packages in the official Python docs if you’re a Python beginner.)

Posted in django python | Leave a comment

apache

Apache

Enable ReWrite

a2enmod rewrite

install wsgi

apt-get install libapache2-mod-wsgi

http://code.google.com/p/modwsgi/wiki/InstallationOnLinux
http://packages.debian.org/unstable/python/libapache2-mod-wsgi

permission denied errro

solved by moving django folder to some user from root folder
i think it can be also solved by assigning sudo to www-data

Rewrite rule

 

  1. RewriteEngine on <br>
  2. RewriteRule ^/?test\.html$ test.php [L]

http://www.sitepoint.com/apache-mod_rewrite-examples/

Posted in Apache | Leave a comment

Mysql

Mysql

 

mysql command line access

mysql -u root -p

Import and Export table

mysqldump -u root -p dev_vclub member_routesfares > member_routesfares_dev.txt
mysql -u root -p demo_vclub_sprint4 < member_routesfares_dev.txt

http://www.tutorialspoint.com/mysql/mysql-database-export.htm

Transfer to other host

tar -cvf demo_vclub_sprint4.tar demo_vclub_sprint4.sql
wget http://api.wolfkrow.com/demo_vclub_sprint4.tar

http://www.digimantra.com/technology/mysql/transfer-database-host-mysqldump-shell/

Split function

CREATE FUNCTION SPLIT_STR(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, ”);

http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/

Edit Bind-address

http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Edit /etc/mysql/my.cnf, run:
bind-address

Grant privllage

for accessing other host mysql

GRANT ALL ON demo_vclub_sprint6.* TO root@’200.53.158.25′ IDENTIFIED BY ‘notouch’

Rename Database

mysqldump -u root -p -v olddatabase > olddbdump.sql
mysqladmin -u root -p create vclub
mysql -u root -p vclub < olddbdump.sql

http://stackoverflow.com/questions/67093/how-do-i-quickly-rename-a-mysql-database-change-schema-name

Replace into

 

Please note that REPLACE INTO is a much slower performer than an UPDATE statement. Keep in mind that a REPLACE INTO requires a test on the keys, and if a matching unique key is found on any or all columns, a DELETE FROM is executed, then an INSERT is executed. There’s a lot of management of rows involved in this, and if you’re doing it frequently, you’ll hurt your performance unless you simply cannot do with any other syntax.

The only time when I can see where you’d actually need a REPLACE INTO is when you have multiple unique constraints on a table, and need to drop any rows that would match any of the constraints. Then REPLACE INTO becomes more efficient from DELETE FROM… INSERT INTO…

http://www.webs05.com/2008/04/06/mysql-difference-between-update-and-replace.html

INSERT INTO user (userid,birthday,first_name,last_name)
VALUES (1234,’1980-03-07′,’Joe’,’Smith’)
ON DUPLICATE KEY UPDATE
birthday = ‘1980-03-07’,
first_name = ‘Joe’,
last_name = ‘Smith’;

http://stackoverflow.com/questions/2930378/mysql-replace-into-alternative

Replication

http://www.howtoforge.com/mysql_database_replication_p2

Posted in Mysql | Leave a comment

Programming

Programming

 

  • The older I get, the more I believe that the only way to become a better programmer is by not programming. You have to come up for air, put down the compiler for a moment, and take stock of what you’re really doing. Code is important, but it’s a small part of the overall process.
  • What I am proposing is that we spend less time coding and more time developing skills in other areas that complement our coding skills. Become a better writer. Become a better speaker. Improve your personal skills. Participate in the community.
  • Programming, like all writing, is just another form of communication. Writing code that the compiler understands is easy. Writing code that other people understand is far more difficult.
  • You won’t– you cannot– become a better programmer through sheer force of programming alone. You can only complement and enhance your existing programming skills by branching out. Learn about your users. Learn about the industry. Learn about your business.
  • The more things you are interested in, the better your work will be.
  • Try to spend some time talking to people instead of the compiler. That’s how you distinguish yourself from your peers. And that’s ultimately how you become a better software developer, too.
  • Ideally, you’d write code, and then write or talk about the code in a way that inspires and illuminates other people.
  • And even if productivity isn’t an issue, the inevitable tides of our economy will be. You will at some point in your career be dealing with a tight job market. And it’s not your technological skills that will determine how well you succeed at those times.
  • It’s your personal skills that will count. How well do you communicate? You should know how to present your ideas both to individuals and small groups. Can you write clearly and somewhat grammatically. Do you come across as confident in yourself and your abilities? Do you have leadership skills (that often translate into management skills)? Are you responsible? Are you a nice person to have around (or at least not completely repulsive)? Yes, there are those who are so technologically brilliant they can get away with caring just about technology, but for most of us these other skills are essential.
  • So, as you go off to college, don’t let your technical classes get in the way of getting a good education. Take a writing class. Take a class or get involved in an activity that forces you to do some public speaking. Do some drama or improv. Join a club. Do some volunteer work. Do some tutoring. This kind of experience will have long term benefits to your career that you wouldn’t believe.
  • http://www.codinghorror.com/blog/2004/09/being-technologically-savvy-isnt-enough.html

Ref:
http://www.codinghorror.com/blog/2007/01/how-to-become-a-better-programmer-by-not-programming.html

Reading Code:

http://www.skorks.com/2010/05/why-i-love-reading-other-peoples-code-and-you-should-too/
http://c2.com/cgi/wiki?TipsFo

Posted in Project Management | Leave a comment

back bone

Backbone.js

 

To declare User model :

 

App.Backbone.User = Backbone.Model.extend();

In above line i am assigning the Backbone model to App.Backbone.User variable .

To declare User Collection :

 

  • we assign the model.

 

  • we bind the add and remove event to collection
App.Backbone.Users = Backbone.Collection.extend({
model : App.Backbone.User,
initialize: function(models, args) {
this.bind(‘add’, this.renderone);
this.bind(‘remove’, this.destroy); },
renderone:function(user){
var view = new App.Backbone.UserView({model: user});
view.render();
var view = new App.Backbone.UserCardView({model: user});
view.render();
},
destroy:function(user){
$(user.view.el).remove();
}
});
  • add event is bind with renderone function
  • remove event with destroy funciton.
  • we can render more than one view while adding .

initialise the Collection  of user

App.Users = new App.Backbone.Users();

add user in collection.

 

var data ={id:’rahul’, username:rahul,firstname:’Rahul’};
App.Users.add(data);

at this point automatically view will be rendered as we bind the add event in collection above.

remove a model

 

App.Users.remove(App.Users.get(‘rahul’));

so on remove view will also remove

User View

 

App.Backbone.UserView = Backbone.View.extend({
tagName: ‘li’,
className: ‘pp-entry group’,
template :_.template(‘<h6><%=username%></h6>’), // very simple can be complex
initialize: function() {
_.bindAll(this, ‘render’);
this.model.bind(‘change’, this.render); // on any change in model the view will render again
this.model.view = this;
},
events:{
“click .addtowallet”:”addlinktowallet”,
},
// Re-render the contents of the Card item.
render: function() {
$(this.el).append(this.templatedetails(this.model.toJSON()));

}
});

 

  • model is binded with the change event , so on every change in model will render the view again automatically.

update a model

var data ={id:’rahul’, username:rahul,firstname:’Rahul’,lastname:’mehta’};
App.Users.get(‘rahul’).set(data);
  • the view also render due to change event in view.

 

References

http://recipeswithbackbone.com/toc.html
http://documentcloud.github.com/backbone/

Posted in UI Js | Leave a comment

redis

Redis

 

Starting Server

 

  • In redis home directory run below command
    • nohup ./redis-server &

 

Geting All Keys

keys *

Deleting Data

 

Data Types

 

  • users is stored as hash
  • channel is  hash
  • buffer as string to store events the (multi level hash)

User

users is stored as hash

Get

 

  • For getting all users list in redis cli
    • KEYS users*
  • For getting particular user data
    • hgetall users.amitab

 

Delete

 

  • deleting particular user
    • del users.rahul
  • To delete a particular key field in below example we are deleting _ command from hash users.amitab
    • hdel users.amitab  _command

 

Channels

 

  • for each gib there is two channel ,  ouside and inside.
  • the structure of  channels in redis : the channels has users key , which is the comma seperated users list which are presents in the channel
  • so for checking we need to split the comma separated list into an array  and perform the operations and then again save the comma separated list.

 

Get

 

  • keys channels*
  • hgetall channels.7-O

Delete

 

  • deleting particular channel

 

  • del channels.7-O
Posted in redis | Leave a comment

django python

Django

Installation

Ubuntu

Update :

sudo apt-get update
sudo apt-get install binutils gdal-bin libproj-dev  python-psycopg2 python-setuptools python-mysqldbsudo easy_install Django

Ref :
https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#ubuntudebian
https://docs.djangoproject.com/en/dev/topics/install/?from=olddocs#installing-an-official-release

Verifying

To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django:

python –version
>>> import django
>>> print django.get_version()
1.3

Starting Project

From the command line, cd into a directory where you’d like to store your code, then run the following command:

django-admin.py startproject mysite

Starting Server

In mysite directory .

sudo python manage.py runserver localhost:8000

Sync Database

python manage.py syncdb

Migrate Database

python manage.py migrate

Importing Data

python manage.py loaddata datadump.json

Dump data

python manage.py dumpdata > rahuldatadump.json

Sql of module

python manage.py sql polls

Adding Field and model to db

python manage.py schemamigration member–add-field Profile.type
python manage.py schemamigration member–add-model Member
python manage.py schemamigration member –add-model OnwardJourneypython manage.py migrate member

http://stackoverflow.com/questions/2902800/django-sync-db-question
http://south.aeracode.org/docs/commands.html#schemamigration

Creating Models

python manage.py startapp polls

Site Module

https://docs.djangoproject.com/en/dev/ref/contrib/sites/#example-usage

Signals

https://docs.djangoproject.com/en/dev/topics/signals/

Django shortcut functions

https://docs.djangoproject.com/en/1.2/topics/http/shortcuts/

Django Admin

One of the most powerful parts of Django is the automatic admin interface. It reads metadata in your model to provide a powerful and production-ready interface that content producers can immediately use to start adding content to the site. In this document, we discuss how to activate, use and customize Django’s admin interface.

Reference :
https://docs.djangoproject.com/en/dev/ref/contrib/admin/

Implementing User Registration

Ref:
http://www.b-list.org/weblog/2006/sep/02/django-tips-user-registration/
http://code.google.com/p/django-registration/wiki/ReadMe

Django Path in Ubuntu

/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/

Django Template

ifcondition

{% ifnotequal user “AnonymousUser” %}
{{ user }}
<a href=”/accounts/logout”>Logout</a>
{% else %}
<a href=”/accounts/login”>Login</a>
{% endifnotequal  %}

http://www.djangobook.com/en/1.0/chapter04/

for escape html in template

FILTER: {{ myhtml |safe }}
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe
TAG: {% autoescape off %}{{ myhtml }}{% endautoescape %}

http://stackoverflow.com/questions/4848611/django-rendering-a-template-variable-as-html

Django url.py

patterns(prefix, pattern_description, …)urlpatterns = patterns(”,

)
urlpatterns += patterns(”,

)
url(regex, view, kwargs=None, name=None, prefix=”)
url(r’^index/$’, index_view, name=”main-view”),

https://docs.djangoproject.com/en/dev/topics/http/urls/

Django Forms

Form.cleaned_data

Each field in a Form class is responsible not only for validating data, but also for “cleaning” it — normalizing it to a consistent format. This is a nice feature, because it allows data for a particular field to be input in a variety of ways, always resulting in consistent output.

>>> data = {‘subject’: ‘hello’,
…        ‘message’: ‘Hi there’,
…        ‘sender’: ‘foo@example.com’,
…        ‘cc_myself’: True}
>>> f = ContactForm(data)
>>> f.is_valid()
True
>>> f.cleaned_data
{‘cc_myself’: True, ‘message’: u’Hi there’, ‘sender’: u’foo@example.com’, ‘subject’: u’hello’}

https://docs.djangoproject.com/en/dev/ref/forms/api/#accessing-clean-data

Ref:
https://docs.djangoproject.com/en/dev/topics/forms/
https://docs.djangoproject.com/en/dev/ref/forms/fields/
https://docs.djangoproject.com/en/dev/ref/forms/widgets/

Query Dict

https://docs.djangoproject.com/en/dev/ref/request-response/#querydict-objects

Django Models

Making queries

all_entries = Entry.objects.all()Entry.objects.filter(pub_date__year=2006)

https://docs.djangoproject.com/en/dev/topics/db/queries/

Model.__unicode__()

he __unicode__() method is called whenever you call unicode() on an object. Django uses unicode(obj) (or the related function, str(obj)) in a number of places. Most notably, to display an object in the Django admin site and as the value inserted into a template when it displays an object. Thus, you should always return a nice, human-readable representation of the model from the __unicode__() method.

class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)def __unicode__(self):
return u’%s %s’ % (self.first_name, self.last_name)

Adding Admin date widget in frontend

{% load adminmedia %} <!–at top –>
<script type=”text/javascript” src=”/admin/jsi18n/”></script>
<script type=”text/javascript” src=”/static/admin/js/core.js”></script>
<link rel=”stylesheet” type=”text/css” href=”/static/admin/css/forms.css”/>
<link rel=”stylesheet” type=”text/css” href=”/static/admin/css/widgets.css”/>
<script type=”text/javascript” src=”/media/js/slides.min.jquery.js”></script>
{{ form.media }}
<link rel=”stylesheet” type=”text/css” href=”/static/admin/css/base.css”/>
<link rel=”stylesheet” type=”text/css” href=”/static/admin/css/global.css”/>
<script type=”text/javascript”>
window.__admin_media_prefix__ = “{% filter escapejs %}{% admin_media_prefix %}{% endfilter %}”;
</script>

Ref :
http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form

django password:

path : /usr/local/lib/python2.7/dist-packages/passwords

http://pypi.python.org/pypi/django-passwords/
https://github.com/dstufft/django-passwords/

translation

mkdir localedjango-admin.py makemessages -l es

django-admin.py compilemessages

locale/de/LC_MESSAGES/django.po:472:70: invalid multibyte sequence

file -i django.po
iconv –from-code=ISO-8859-1 –to-code=UTF-8 django.po > django_utf8.po

http://stackoverflow.com/questions/5895716/non-english-character-getting-changed-to-character-in-linux

Will not show message if some fuzzy word in .po file

django date time format

print datetime.now().strftime(“%Y/%m/%d %H:%M:%S”)

django xml parse by string

from xml.etree.ElementTree import XML, fromstring, tostring
parsed = fromstring(ncServerData)
print ‘parsed’
# print parsed.attr(‘cd_error’)
for item in parsed.findall(‘cd_error’):
cd_error=item.text
for item in parsed.findall(‘nb_error’):
nb_error=item.text
for item in parsed.findall(‘response’):
response=item.text
ncServerData=’ ‘+response+’ ‘+cd_error+’ ‘+nb_error

Error Handling

try:
c = pycurl.Curl()
c.setopt(pycurl.URL, ncServerURL)
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.POSTFIELDS, “xml=”+str(body))
import StringIO
b = StringIO.StringIO()
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.perform()
except Exception, e:
print e, repr(e), e.message, e.args

Generate Unique ID:

>>> import uuid
>>> x=uuid.uuid4()
>>> str(x)
‘07033084-5cfd-4812-90a4-e4d24ffb6e3d’

Switch Statement

as function

result = {
‘a’: lambda x: x * 5,
‘b’: lambda x: x + 7,
‘c’: lambda x: x – 2
}[value](x)

normal

def f(x):
return {
‘a’: 1,
‘b’: 2,
}[x]

String Replace

str = “this is string example….wow!!! this is really string”;
print str.replace(“is”, “was”);
print str.replace(“is”, “was”, 3);

http://www.tutorialspoint.com/python/string_replace.htm

Django FTP Upload

import ftplibsftp = ftplib.FTP(‘cognisys.net’,’cognisys’,’bij897jib’) # Connect
fp = open(‘urls.py’,’rb’) # file to send
sftp.storbinary(‘STOR volaris/url.py’, fp) # Send the file

fp.close() # Close file and FTP
sftp.quit()

http://love-python.blogspot.in/2008/02/ftp-file-upload.html

Make csv

import csv
import sysf = open(‘testcsv.csv’, ‘wt’)
try:
writer = csv.writer(f)
writer.writerow( (‘Title 1’, ‘Title 2’, ‘Title 3’) )
for i in range(10):
writer.writerow( (i+1, chr(ord(‘a’) + i), ’08/%02d/07′ % (i+1)) )
finally:
f.close()

print open(‘testcsv.csv’, ‘rt’).read()

santandar curl

import pycurl
ncServerURL=’https://dev.mitec.com.mx/wscobroSdos/CobroAirlines&#8217;
binaryptr = open(‘sample.xml’,’rb’).read()
c = pycurl.Curl()
c.setopt(pycurl.URL, ncServerURL)
c.setopt(pycurl.POST, 1)c.setopt(pycurl.NOSIGNAL, 1) # disable signals, curl will be using other means besides signals to timeout.
c.setopt(pycurl.POSTFIELDS, “xml=”+binaryptr)
import StringIO
b = StringIO.StringIO()
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.perform()
ncServerData = b.getvalue()
print ncServerData

Pycurl working with open ssl

I figured I’d post a workaround for people to fix the python-pycurl
package themselves.1.) sudo apt-get install build-essential fakeroot dpkg-dev
2.) mkdir ~/python-pycurl-openssl
3.) cd ~/python-pycurl-openssl
4.) sudo apt-get source python-pycurl
5.) sudo apt-get build-dep python-pycurl
6.) sudo apt-get install libcurl4-openssl-dev
7.) sudo dpkg-source -x pycurl_7.xxx.dsc
8.) cd pycurl-7.xxx
9.) Edit the debian/control file and replace all instances of
“libcurl4-gnutls-dev” with “libcurl4-openssl-dev”
10.) sudo dpkg-buildpackage -rfakeroot -b
11.) sudo dpkg -i ../python-pycurl_7.xxxx_i386.deb

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515200

XML Dom Parser

parsed = parseString(resp_avail)
xmlTag = parsed.getElementsByTagName(‘DepartureAirport’)[0].toxml()
xmlTag1 = parsed.getElementsByTagName(‘DepartureAirport’)[1].toxml()
# xmlData=xmlTag.replace(‘<DepartureAirport>’,”).replace(‘</DepartureAirport>’,”)
print parsed.getElementsByTagName(‘DepartureAirport’)[0].attributes[“LocationCode”].value

http://www.travisglines.com/web-coding/python-xml-parser-tutorial

http://www.diveintopython.net/xml_processing/attributes.html

django indentaion

python -m tabnanny <name of python file>

http://stackoverflow.com/questions/1016814/what-to-do-with-unexpected-indent-in-python

django Apache

sudo touch apache/django.wsgi

https://code.djangoproject.com/wiki/django_apache_and_mod_wsgi

declaring array

a=[]

Iteration over model instance

from django.core import serializers
data = serializers.serialize( “python”, SomeModel.objects.all() )

Ref :

http://stackoverflow.com/questions/2170228/django-iterate-over-model-instance-field-names-and-values-in-template

simple loop

for idx, val in enumerate(ints):
print idx, val

http://stackoverflow.com/questions/522563/accessing-the-index-in-python-for-loops

json library

json.dump
json.load

http://docs.python.org/library/json.html

django validation

http://eikke.com/django-validation-an-introduction/

Steps to configure apache with django

1. Create a virtual host entry as below.

<VirtualHost demo.wolfkrow.com:80>
ServerAdmin webmaster@localhost
ServerName demo.wolfkrow.com
DocumentRoot /home/vclub/vclubcms
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/vclub/vclubcms/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/en/(.*)$ /$1 [R]
RewriteRule ^/es/(.*)$ /$1 [R]
</Directory>
WSGIDaemonProcess vclubcms processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup vclubcms
WSGIScriptAlias / /home/vclub/vclubcms/apache/django.wsgi</VirtualHost>

2. Create apache/django.wsgi in your codebase with content as follows:

import os
import syspath = ‘/home/vclub’
if path not in sys.path:
sys.path.insert(0, ‘/home/vclub’)

os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘vclubcms.settings’

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

3. Restart Apache

Note: This assumes the basepath is /home/vclub and codebase is in /home/vclub/vclubcms

References :

https://docs.djangoproject.com/en/1.3/intro/tutorial01/
https://docs.djangoproject.com/en/1.3/intro/tutorial02/

Posted in django python | Leave a comment

tiny mce with selenium ide..

Use type as a command.
The target is: dom=document.getElementById(‘mce_editor_0’).contentDocument.body
where ‘mce_editor_0’ is the id of iframe containing the tinyMCE editor.
In value put the content you want in the editor.
Working example in Selenese:
<code>
<tr>
    <td>type</td>
    <td>dom=document.getElementById(‘mce_editor_0’).contentDocument.body</td>
    <td><p>Editor content</p></td>
</tr>
</code>
Posted in Project Management | Leave a comment

softw. business

a) You are targetting a new or underserved niche market. Old or saturated market means a lot of powerful competitors fighting for same customers.
b) You will be providing a new, cheap or better solution than existing ones. If not why will anyone buy your solution?
c) Using new distribution channels to provide solutions more efficiently( e.g., bookmyshow, IRCTC use internet to distribute movie and railway tickets)
d) There is demand of your solution in market.
e) The idea is feasible(you have or can arrange the capital, man power and technical/business skills to implement your idea)
f) Your idea is profitable. i.e. You earn more than you expend.

Think about your idea, take feedback about it from others in your social circle, improve and finalize it.

inks:
http://www.paulgraham.com/ideas.html
http://www.paulgraham.com/start.html
http://www.paulgraham.com/mit.html

2. Startup Team/ Board of Advisors – The next logical step will be to look for co-founders who can compliment to your skills and are as enthusiastic about your idea as you are. It is good to have a technology geek, a design expert and a marketing guy in your team. Also, form a board of advisors (experienced industry experts who will share their advice when needed).

3. Create a business plan – a detailed one for your own use and a short customized one if needed for raising capital. Remember that a good plan is one that is flexible to change coz most of the time it will be never done exactly as planned.

4. Develop Product prototype(if hardware product) or beta version(if software) of your product (If possible in garage. :p).

5. Register your company. Hire a Charted Accountant and he will do it for you.
Links :
http://www.doingbusiness.org/data/exploreeconomies/india/starting-a-business
http://www.legalserviceindia.com/company%20law/company_formation_procedure.htm
http://companiesinn.com/companyregistrationindia/stampduty_modi.php?ac=100000&sc=DL
http://madaan.com/incorporateprocedure.html

6. Protect your assets using copyright, trademarks and patents.
Links:
http://madaan.com/trademarks.html
http://companiesinn.com/companyregistrationindia/trademark.php
http://ezinearticles.com/?Copyright-in-India:-Law-and-Procedure&id=73309
http://madaan.com/patents.html

7. Create your online presence. Get a website, online demo, blog and use social networks to promote awareness about your product/offers.

8. Raise capital for your business if neededfrom Angel Investors, VCs or events like proto.in. Its better if you can do without external funding. Just bootstrap your startup.
Links:
http://www.paulgraham.com/fundraising.html
http://www.paulgraham.com/startupfunding.html
http://proto.in

9. Setup office cum development center. Try to do it in minimum possible investment. Take office space on rent/lease. Use second hand furnitures and computers. Use open source softwares. Get your work done but minimize the expenses wherever possible.

10. Hire employees. Golden rule – Always hire the best for the job even if you need to pay them more than you pay yourself.

11. If needed get into strategic partnerships with other firms and organization to provide integrated products/offerings or market/distribute your products.

12. Develop version 1.0 of your product/ Create customer support system.

13. Prepare and execute your product release and marketing plan. Sell your product.

14. Manage cashflow and business operations.

15. Keep improving and never stop.

Simply put, chances are you won’t think of the next big thing. Even if you do, you probably won’t have the resources, experience, or contacts, to turn your idea into billions. We were not expecting miracles but were on the lookout many months in advance. One thing we learned while reading Founders At Work is that many software startups are formed without the faintest clue of what the product/service will be. The most important part of the company is not the idea but the people. A small and closely knit team of people who’ve worked together in the past is a recipe for success, regardless of the idea. Indeed, execution is key! Partnering with people who have a track record of bringing ideas to reality is, in our opinion, the most important part of the business.

We are very happy that we did not wait on having a brilliant breakthrough idea and started our company immediately. We evaluated opportunities and picked the one that made the most business sense, knowing we can adapt along the way. Having made the plunge early in our careers, we felt we didn’t have anything to lose because we didn’t have that many constraints such as leaving a high paying job, a mortgage and student loans to pay, kids to feed, etc. The more acquainted you get with stable employment, the harder it is to leave. Still, it is worth mentioning that while we were very comfortable with our technical skills, our network of contacts is not as large as it would have been if we had been under someone else’s employment for 5-10 years. On the bright side, we don’t have 10 year of accumulated bitterness to carry around and we’re in the best phase of our development careers (from a production standpoint).

 

http://blog.lavablast.com/post/2008/03/11/Software-Startup-Lessons-%28Part-1%29-The-Basics.aspx

Posted in Uncategorized | Leave a comment