dat’s diary

Just another WordPress.com weblog

Archive for May 2011

How to have 2 web addresses point to the same index.html

leave a comment »

Lets say you have an index.html currently hosted on offover.com and you just bought another domain ndat.org. Here are the steps you need to do so that whenever user types offover.com or ndat.org, the same index.html file is displayed (note that I host on rackspace and bought my domain on godaddy):
1. Go to godaddy.com and change your DNS server to DNS1.STABLETRANSIT.COM DNS2.STABLETRANSIT.COM
2. Go to manage.rackspacecloud.com, click on cloud servers, click on the name of your box, click on DNS, click on Add
3 Add various entries so they look sth like this:

 

 

 

 

 

 

 

 

 

 

 

 

 

4. Go to ndat.org. Your index.html should be there (Note I also changed my blog and my mail entries so that things still work whenever users type mail.ndat.org or  blog.ndat.org

Advertisements

Written by bluekite2000

May 30, 2011 at 10:01 pm

Posted in Uncategorized

How to copy a django site and run it on the same hosting provider

with one comment

After you set up a site on your beloved host, and it s working fine, you may get ambitious and create another site. But you don’t want to buy another vps. Here is what you do to copy clone a working site to a new site:
1. Ssh to your vps and configure your virtual host. http://library.linode.com/lamp-guides/ubuntu-10.04-lucid
2. cd /etc/apache2/sites-available/ and cp oldsite.com newsite.com. Edit newsite.com accordingly
3. cd /srv/www/ and cp -r oldsite.com/ newsite.com
4. cd newsite.com and edit it accordingly (settings.py, urls.py,django.wsgi)
5. a2ensite newsite.com
6. /etc/init.d/apache2 reload
7. visit newsite.com. It should work.

Written by bluekite2000

May 18, 2011 at 9:18 pm

Posted in Uncategorized

How to install wordpress on a ubuntu box

leave a comment »

0. This article assumes you have purchased a vps somwhere (I use linode) and have ssh’ed into it.
1. Make sure you have a lamp stack set up (ie install and set up apache,mysql and php5)
http://library.linode.com/lamp-guides/ubuntu-10.04-lucid
2. download and install wordpress
http://library.linode.com/lamp-guides/ubuntu-10.04-lucid
3. if everything is set up correctly, when you go to example.com, you should see


















4. Before you proceed, install phpmyadmin and use it to create a wordpress database
http://www.blog.highub.com/linux/install-and-configure-phpmyadmin-on-ubuntu-lamp/
http://codex.wordpress.org/Installing_WordPress#Step_2:_Create_the_Database_and_a_User
If all goes well you should see this screen


















5. Click on run install. The rest should be straightforward.

Other things that you may want to look into:
-configure mail server
-nginx
-fastcgi
-.htaccess

Written by bluekite2000

May 12, 2011 at 8:13 pm

Posted in Uncategorized

How to deploy a simple django site on Linode’s Ubuntu box

with one comment

Recently I made a site called glassesonme.com, which lets a user upload his face and see what it looks like with glasses. It was my first time learning Django so I struggle a bit to get it working. I wrote the steps down and here they are:
0. Buy a vps on linode.com
1. Buy a domain name example.com on enom or godaddy. Log in and change name server to ns1.linode.com and ns2.linode.com.
2. Open terminal and do whois example.com to see if name server has been changed
4. Log in linode and configure dns http://library.linode.com/dns-guides/configuring-dns-with-the-linode-manager
5. Wait a little while and ping http://www.example.com to make sure the ip’s address of example is the one given by linode.com
6. While logged in linode, build a ubuntu box.
7. ssh to your box and install apache2. Once installed, you need set up apache server so when a user types in example.com, apache will know what file to server to user. I use this http://library.linode.com/lamp-guides/ubuntu-10.04-lucid
7a. Now you need to install python, mysql, django, and other relevant libs on your box. I used this link http://simonsstuffandthings.blogspot.com/2011/02/how-to-install-django-on-ubuntu-using.html.
7b. I needed to install opencv. So I used this http://subsumption.blogspot.com/2010/05/opencv-21-on-ubuntu-1004.html. By the way don’t use centos to install opencv w/ python wrappers. I had many problems and ultimately switched to ubuntu.
7c. To make sure things are installed correctly, type python to see python’s version. While in python’s interactive terminal, type import Image or import Django or import cv. If no error is given, then you are good.
8. Go to example.com. You should see a Django’s welcome page.
9. Assuming you have a working code on your localhost, just upload it to your vps. Restart apache (/etc/init.d/apache2 restart) and you r done. If there is some error, do tail -f /var/log/apache2/error.log. I highly recommend running firebug. You can detect many errors this way.

Miscellaneous errors and solutions:
1. “FATAL: Module raw1394 not found”: This happens when I try to use opencv. I fixed this by doing “touch /dev/raw1394”
2. “No module named csrf”: This happens when I used an older version of django. I fixed this by upgrading to 1.2.3 by following this instruction http://www.hackrunner.com/2010/12/installing-django-1-2-3-on-ubuntu-10-10/
3. I had to uninstall and reinstall apache2. I used this link http://ubuntuforums.org/showthread.php?t=1071947&page=2 to unintall apache2 completely

Useful links
1. To get started with django, I use this code http://lethain.com/intro-to-unintrusive-javascript-with-django/
2. To upload an image using jquery, I use this http://kuhlit.blogspot.com/2011/04/ajax-file-uploads-and-csrf-in-django-13.html
3. To detect faces and eyes, I use this http://japskua.wordpress.com/2010/08/05/removing-red-eyes-with-opencv-and-python/
4. To get ubuntu+mod_wsgi+apache working I use this http://library.linode.com/web-servers/apache/mod-wsgi/ubuntu-10.04-lucid
5. To get ubuntu+mod_wsgi+apache+django I use this http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
6 While working on the actual site, I put up a placeholder so visitors can subscribe. The placeholder I use is http://medialoot.com/item/free-html5-coming-soon-template/

I hope this write-up helps. I might have forgotten a thing or two so feel free to let me know.

Written by bluekite2000

May 5, 2011 at 9:17 pm

Posted in Uncategorized

How to get a “do not duplicate” key duplicated

leave a comment »

Many key stores in America won’t do it for fear of lawsuit. Here in SF, I went to both Home Depot and privately-owned stores, only to be refused time and time again. So here is what I did:
-tape up the “do not duplicate” phrase. Make sure the tape goes round the key many times (ie impossible to take off)
-write a random number on the tape (or whatever justifies the tape).
-confidently walk into ANY key store and have it made

Written by bluekite2000

May 5, 2011 at 8:39 pm

Posted in Uncategorized