Thursday 9 August 2012

Adding Django-catalog

Django-catalog
This application was created to organize the objects in a tree structure.

Installation
A. Download

At present, a stable release Django-catalog there, but you can download the development version from the repository on github

pip install django-catalog


Two. Connect the application

To connect the installed Django-catalog, add in your project settings.py configuration file the following contents

INSTALLED_APPS = (
    'Catalog',
    'Catalog.contrib.defaults',

)
Three. Connect URLs applications

Add the URL of the application in the Django-catalog of your project urls.py

To use the scheme to access items on the tree slug

urlpatterns  = patterns ('',
    (r '^ catalog /', include ('catalog.urls.by_slug')),
)

To use the scheme to access elements of a tree on their id

urlpatterns  = patterns ('',
    (r '^ catalog /', include ('catalog.urls.by_id')),
)

4. Creating models

In order to use the directory to create for him a model. Previously, we hooked INSTALLED_APPS application directory implements the basic models and methods of work with them. At this stage, to ensure the health directory, we have enough. Start the synchronization of the database to create a catalog of standard models

python manage.py syncdb

Five. The administrative interface

To fill the catalog of categories and products go to the Django administration interface and select the Manage catalog.

6. The use of templates

Django-catalog is supplied with ready-made templates for the work, which should be enough to start using the directory.

Friday 3 August 2012

Matrix on terminal

First of all, install cmatrix using the following command:

$ sudo apt-get install cmatrix

After cmatrix is installed, run the followinf command with different options such as, -a, -b, -B, etc

$ cmatrix -b

and what you get is the output. :-)

Terminal music player

For the past two months i have been using terminal(mplayer) to play my
songs, I found it quite interesting to use terminal to play music than
using some other applications. I learnt how to use mplayer and run
songs on it, everytime I had to select a song, then play it and run
the command

mplayer abc.mp3

Then came the issue of playing multiple songs, used

mplayer *.mp3

Then I wanted the songs to play in a random pattern(shuffle). For that
I created a playlist in the directory containing the .mp3 files and
ran command

 find -type f -iname \*.mp3 > demon.txt

and hence a playlist named demon.txt is created, I would run it using
the command

mplayer -shuffle -playlist demon.txt

this would play songs in shuffle pattern. I created a script to play
songs in shuffle. But there was a problem that the script would run
only if the Drive containing .mp3 files and the playlist was mounted,
and if the drive was unmounted it would show error. I then learnt to
Mount drive using terminal commands and making small changes, and made
a script that would play when the drive was unmounted. One can learn
how to mount a drive from terminal from
https://help.ubuntu.com/community/Mount/USB

Now i have finally made a script, that checks whether the .mp3
containing drive is mounted or not, if the drive is mounted it simply
plays song from the playlist demon.txt.
and if the drive is not mounted, the script would fetch another script
in my folders that would unmount the drive and then run the playlist
demon.txt.

Here is the script i use, kept in my home folder
http://202.164.53.122/~daman/scripts/hi.sh

And the other script I use to Mount
http://202.164.53.122/~daman/scripts/demon.sh


I am really happy, removed banshee and rhythm box from my system :D.