Latest Entries »

I tried to use

sudo service networking restart

and

sudo /etc/init.d/network restart

but they both crash the window manager and I can no longer use my keyboard for input into X.

Try

sudo service network-manager restart

instead.

Ubuntu uses network-manager instead of the traditional Linux networking model. so you should restart the network-manager service instead of the network service.

MySql                                              Postgres

show database                                  \l

show tables;                                       \d

desc table table_name;                    \d+  table_name    or   \d  table_name

If you want to search column name as last_modified you will give the following query in postgres

select table_name from information_schema.columns where column_name = 
'last_modified

comment the following line in settings.py
‘django.middleware.csrf.CsrfViewMiddleware’,

add this in urls.py

(r’^AddressBook/Update/(?P<addressbook_id>\d+)/’, ‘djtest.AddressBook.views.update’),

detail.html should be like this
<a href=”../../Index/”>Go Back</a><br>
<table>
<tr><td>ID</td><td>{{detail_data.id}}</td></tr> <form action=”/Index/New/” method=”post”>
<table>
<tr><td>FirstName</td><td>{{detail_data.firstname}}</td></tr>
<tr><td>LastName</td><td>{{detail_data.lastname}}</td></tr>
<tr><td>Phone</td><td>{{detail_data.phone}}</td></tr>
<tr><td>Address</td><td>{{detail_data.address}}</td></tr>
<tr><td>Date</td><td>{{detail_data.mod_date}}</td></tr>
</table>
</form>

Simple Sample Django Project

Hi,

Go through the following link for a sample Django project.

http://xxki.com/tutorial/pukiwiki.php?Python%2FDjango%20-%20Sample%20Project

It has some issues i had experience with it and solved that if you can find and solve it and share your experience here.. Otherwise see my post http://suji25.wordpress.com/2013/03/15/solution-for-simple-sample-django-project/

<html>

<head>

<script type=”text/javascript”>

function pri()

{

document.getElementById(“pr”).style.visibility=hidden;

window.print();

}

</script>

</head>

<body>

Test page for printing

<br>

<input type=”button” id=”pr” value=”Print” onclick=”pri()”>

</body>

</html>

This is sample coding to create two slide show in a same page

<html>
<head>
<script type=”text/javascript”>
<!–
var image1=new Image()
image1.src=”sample/images/black-berry.jpg”
var image2=new Image()
image2.src=”sample/images/i-Mate.jpg”
var image3=new Image()
image3.src=”sample/images/lg.jpg”
var test1=new Image()
test1.src=”sample/images/nokia1.jpg”
var test2=new Image()
test2.src=”sample/images/nokia2.jpg”
var test3=new Image()
test3.src=”sample/images/nokia1.jpg”
//–>
</script>
</head>
<body>
<img src=”sample/images/black-berry.jpg” name=”slide” width=”100″ height=”300″ />
<img src=”sample/images/nokia1.jpg” name=”slideshow” width=”100″ height=”300″ />
<script>
<!–
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval(“image”+step+”.src”)
document.images.slideshow.src=eval(“test”+step+”.src”)
if (step<3)
step++
else
step=1
//call function “slideit()” every 2.5 seconds
setTimeout(“slideit()”,2500)
}
slideit()
//–>
</script>
</body>
</html>

$ gedit mail.pl

add the following line in the file

$result=system(“mail -s \”hello\” xxx\@gmail.com < test.txt”);

$ perl mail.pl

It will send the mail with the subject hello and the content in test.txt file too xxx@gmail.com

Backuping a single table from a database

mysqldump -u -p database1 table_name > /home/backups/table_name.sql

Restoring the table into another database

mysql -u -p database2 < /home/backups/table_name.sql

Mercurial is not available in yum.

Building from source is easy, but requires an extra step:

# wget http://mercurial.selenic.com/release/mercurial-1.3.1.tar.gz
# tar xzf mercurial-1.3.1.tar.gz
# cd mercurial-1.3.1
# sudo make install

# export PYTHONPATH=/usr/local/lib/python2.4/site-packages

add to ~/.bash_profile

PYTHONPATH=/usr/local/lib/python2.4/site-packages
export PYTHONPATH

Follow

Get every new post delivered to your Inbox.