- The display property can be set to:
- block - takes up entire width of the html page and does NOT let any other elements sit next to it.
- inline-block - allows other elements to sit next to it self in the same line
- inline - allows elements to sit in the same line. Useful only for block elements like <p>, as otherwise the element loses its dimensions
- none - the element is not displayed.
- To place an element in the center of the page use "margin:auto" as the style.
- We can use negative margin/padding to move element off the page as well.
- When you float an element on the page, you're telling the webpage: "I'm about to tell you where to put this element, but you have to put it into the flow of other elements." This means that if you have several elements all floating, they all know the others are there and don't land on top of each other.
- If you tell an element to
clear: left
, it will immediately move below any floating elements on the left side of the page; it can also clear elements on theright
. If you tell it toclear: both
, it will get out of the way of elements floating on the left and right! - If you don't specify an element's positioning type, it defaults to
static
. This just means "where the element would normally go." If you don't tell an element how to position itself, it just plunks itself down in the document. - The first type of positioning is absolute positioning. When an element is set to
position: absolute
, it's then positioned in relation to the first parent element it has that doesn't haveposition:static
. If there's no such element, the element withposition: absolute
gets positioned relative to<html>
. - Relative positioning is more straightforward: it tells the element to move relative to where it would have landed if it just had the default
static
positioning. - Finally, fixed positioning anchors an element to the browser window—you can think of it as gluing the element to the screen. If you scroll up and down, the fixed element stays put even as other elements scroll past.
Here, I post stuff that i have got chance to explore. I put in the links to the articles that i find most suitable, and as i explore the topic more i add my own comments as well.
Sunday, 29 September 2013
CSS Positioning
Wednesday, 25 September 2013
Setting up Django Web-app on amazon linux - AWS micro instance
- SSH into your linux AWS system using a command like this:
chmod 400 ~/pvtkey.pem ssh -i ~/pvtkey.pem ec2-user@<AWS-instance-public-IP>
- Install Apache httpd server:
sudo yum install httpd
sudo /etc/init.d/httpd start OR
service httpd start
sudo chkconfig httpd on
- You can check what is installed with RPM
rpm -qa
- Install Django:
wget https://www.djangoproject.com/m/releases/1.5/Django-1.5.4.tar.gz
tar xzvf Django-1.5.4.tar.gz
cd Django-1.5.4
sudo python setup.py install
- Install mod_wsgi:
sudo yum install mod_wsgi
- Add a new user for django:
sudo useradd djangousersu - djangouser
- Edit http.conf file:
sudo vi
/etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
WSGIDaemonProcess ec2-54-200-XXX-XXX.us-west-2.compute.amazonaws.com user=djangouser group=djangouser processes=5 threads=1
WSGIProcessGroup ec2-54-200-XXX-XXX.us-west-2.compute.amazonaws.com
DocumentRoot /home/djangouser/web-app
ServerName ec2-54-200-XXX-XXX.us-west-2.compute.amazonaws.com
ErrorLog /home/djangouser/web-app/apache/logs/error.log
CustomLog /home/djangouser/web-app/apache/logs/access.log combined
WSGIScriptAlias / /home/djangouser/web-app/apache/django.wsgi
<Directory /home/djangouser/web-app/apache>
Order deny,allow
Allow from all
</Directory>
<Directory /home/djangouser/web-app/templates>
Order deny,allow
Allow from all
</Directory>
<Directory /home/djangouser/web-app/bmdata/static>
Order deny,allow
Allow from all
</Directory>
<Directory /usr/lib/python2.6/site-packages/django/contrib/admin/static/admin/>
Order deny,allow
Allow from all
</Directory>
LogLevel warn
Alias /static/admin/ /usr/lib/python2.6/site-packages/django/contrib/admin/static/admin/
Alias /static/ /home/djangouser/web-app/bmdata/static/
</VirtualHost>
WSGISocketPrefix /home/djangouser/web-app/apache/run/
- Add django.wsgi
import os, sys sys.path.append('/home/djangouser/web-app') os.environ['DJANGO_SETTINGS_MODULE'] = 'BMonitor.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
- Installing python libs for matplotlib and numpy on AWS
sudo yum install gcc-c++
sudo yum install gcc-gfortran
sudo yum install python-devel
sudo yum install atlas-sse3-devel
sudo yum install lapack-devel
sudo yum install libpng-devel
sudo yum install freetype-devel
sudo yum install zlib-devel
tar xzvf matplotlib-1.3.1.tar.gz
cd matplotlib-1.3.1
sudo python setup.py build
sudo python setup.py install
Saturday, 7 September 2013
Using wget to download an ASP site
You can download an ASPX site, which asks for username/password for log in as follows:
First provide the username/password to the login page and save the cookie file.
wget --mirror -r \
--user-agent="" \
--keep-session-cookies --save-cookies cookies.txt \
--post-data '__VIEWSTATE=%2FwEPDwULLTE3MDc5MjQzOTdkZIP%2Fxc105yfz2jGFj4Nd3tPvrEeNara43fIRI5oAW%2Bwv&__EVENTVALIDATION=%2FwEWBAKisoyCAwLB2tiHDgK1qbSRCwL2k8O9DUQa5owMFDWzFnBoIDusNkznjB65a6zRyNETOEZfBM1o&txtUser=admin&txtPassword=admin&login_btn=Sign+In' \
-E -k -p http://www.xyz.com/Login.aspx
Then you can access other pages in the next step using the above generated cookie files.
wget --mirror -r \
--user-agent="" \
--keep-session-cookies --load-cookies cookies.txt \
-E -k -p http://www.xyz.com/Index.aspx
For details of the options, refer to the WGET manual i.e "man wget" :)
First provide the username/password to the login page and save the cookie file.
wget --mirror -r \
--user-agent="" \
--keep-session-cookies --save-cookies cookies.txt \
--post-data '__VIEWSTATE=%2FwEPDwULLTE3MDc5MjQzOTdkZIP%2Fxc105yfz2jGFj4Nd3tPvrEeNara43fIRI5oAW%2Bwv&__EVENTVALIDATION=%2FwEWBAKisoyCAwLB2tiHDgK1qbSRCwL2k8O9DUQa5owMFDWzFnBoIDusNkznjB65a6zRyNETOEZfBM1o&txtUser=admin&txtPassword=admin&login_btn=Sign+In' \
-E -k -p http://www.xyz.com/Login.aspx
Then you can access other pages in the next step using the above generated cookie files.
wget --mirror -r \
--user-agent="" \
--keep-session-cookies --load-cookies cookies.txt \
-E -k -p http://www.xyz.com/Index.aspx
Subscribe to:
Posts (Atom)