Compile a higher verison of the Python for Centos

The version of the python comes with CentOS is 2.4, sometimes you need a higher version of the python. In order to get one, you can do the following steps:



1. download python source

2. tar -zvxf Python-2.7.2.tar.bz2

3. enter the folder Python-2.7.2

4../configure --prefix ~/app/Python-2.72

5. make

6 make install

These process will not ovewrite the installed verion of your CentOS.

Compile a higher verison of the Python for Centos

 

 

The version of the python comes with CentOS is 2.4, sometimes you need a higher version of the python. In order to get one, you can do the following steps:

1. download python source

2. tar -zvxf Python-2.7.2.tar.bz2

3. enter the folder Python-2.7.2

4../configure --prefix ~/app/Python-2.72

5. make

6 make install

These process will not ovewrite the installed verion of your CentOS.

Create Symbolic Links in linux

ln -s {source_file} {symbolic_filename} in this command, you muct use obsolute part to the files

Create Symbolic Links in linux

ln -s {source_file} {symbolic_filename} in this command, you muct use obsolute part to the files

Find files containing something in Linux

Grep

1. grep -lir "String_to_find" * :searching from the current path

-l print only the file names containing your search term

-r recursive

-i case insensitive

* all files
grep -iw glcore XFree86.0.log search glcore in file XFree86.0.log

-w means whole word match

Find
1. find /start_path -name *.txt | grep -lir "some text" *   : start searching from the given path
$ find / -name arrow.jpg
$ find ~ -name 'arrow*.xbm'
$ find ~ -name '*.xbm'
$ find / -uid 1005

Locate
$ locate -i filename


Find files containing something in Linux

Grep

1. grep -lir "String_to_find" * :searching from the current path

-l print only the file names containing your search term

-r recursive

-i case insensitive

* all files
grep -iw glcore XFree86.0.log search glcore in file XFree86.0.log

-w means whole word match

Find
1. find /start_path -name *.txt | grep -lir "some text" *   : start searching from the given path
$ find / -name arrow.jpg
$ find ~ -name 'arrow*.xbm'
$ find ~ -name '*.xbm'
$ find / -uid 1005

Locate
$ locate -i filename


Django CSFR token missing or incorrect problem will you using forms

Django CSFR token missing or incorrect problem will you using forms. Possible ways to resolve this problem are:

1. add {% csrf_token %} in your form content and it will be converted into a hidden field in the form. Once you check the source code of the form you will see it.



{% extends "base.html" %}

{% block title %}Create Event - {{block.super}}{% endblock %}
{% block main_content %}
   
        {% csrf_token %}
       

                {{form.as_ul}}
           

       

   
{% endblock%}



Source cod ein the web browser:



   
        Create Event - start the dark
       
   
   
       
   
       

       

               
  • Description:


  •        

       

   

       
   


2. The other way to solve the problem is: comment  the following setence in your Django configure file.It solves the problem however, this is the very bad way to do it since you will lose CSRF protection by doing so.
 #'django.middleware.csrf.CsrfViewMiddleware'


Source: http://joelklabo.wordpress.com/2010/06/09/more-django-csrf-token-fun/

Django CSFR token missing or incorrect problem will you using forms

Django CSFR token missing or incorrect problem will you using forms. Possible ways to resolve this problem are:

1. add {% csrf_token %} in your form content and it will be converted into a hidden field in the form. Once you check the source code of the form you will see it. <Correct Way to do>



{% extends "base.html" %}

{% block title %}Create Event - {{block.super}}{% endblock %}
{% block main_content %}
    <form method="POST" action="" >
        {% csrf_token %}
        <ul>
            {{form.as_ul}}
        </ul>
        <input type="Submit" value="Create Event"/>

    </form>
{% endblock%}



Source cod ein the web browser:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Create Event - start the dark </title>
       
    </head>
    <body>
       
    <form method="POST" action="" >
        <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='471f168bfebf80ca7a26caad39e54aca' /></div>
        <ul>
            <li><label for="id_description">Description:</label> <textarea id="id_description" rows="10" cols="40" name="description"></textarea></li>

        </ul>
        <input type="Submit" value="Create Event"/>

    </form>

       
    </body>
</html>

2. The other way to solve the problem is: comment  the following setence in your Django configure file.It solves the problem however, this is the very bad way to do it since you will lose CSRF protection by doing so.
 #'django.middleware.csrf.CsrfViewMiddleware'


Source: http://joelklabo.wordpress.com/2010/06/09/more-django-csrf-token-fun/

In Broswer Blog Editor: Scribefire-next

Have been using this program for in browser (Firefox) for a while it is kindly neat. In order to use this little program you need to link you blog account with it.

 Here is the developer’s website, you can download the most updated version from it.

http://www.scribefire.com/

In Broswer Blog Editor: Scribefire-next

Have been using this program for in browser (Firefox) for a while it is kindly neat. In order to use this little program you need to link you blog account with it.

 Here is the developer’s website, you can download the most updated version from it.

http://www.scribefire.com/

Backup file in Linux with timestamp in file name

cp .`date +%Y%m%d%H%M%S`

For example:

cp file file_`date +%m%d%y%H%S%M`


The file name will be as something like file_070611153331

Backup file in Linux with timestamp in file name

cp <file name> <filename>.`date +%Y%m%d%H%M%S`

For example:

cp file file_`date +%m%d%y%H%S%M`


The file name will be as something like file_070611153331

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...