Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, January 24, 2013

Downloading You Tube Video

Downloading You Tube videos will not be headache any more now. As a simple utility in linux exists to download them effectively.

$ sudo apt-get install youtube-dl

//To install the utility

Then to download just do the following

$ youtube-dl youttube url

just like

$youtube-dl http://www.youtube.com/watch?v=KU8r1mNC3iM

Press Enter and you are done. That easy stuff!!

Wednesday, October 17, 2012

Creating Simple Android Application

Today I am going to start with How to make a Simple Application in Android. Before Starting It we must be clear about some aspects related to Android Development. As We already know now from previous post about Setting up of Android SDK with Eclipse. So We will uncover the basic file hierarchy of Android App.

Starting of Android Application. 

  • Open Up your Eclipse. Then go to File - > New Project - > Android Project. A dialog box will be opened up as shown.
New Android Project
  • Now you have to fill some details. Like Project Name, Project Location. After Clicking Next you will be asked to Select for API version. Select According to your requirement.
  • After then Enter Package name like if your application name is sample. Then Package can be com.simple. Check for Activity automatic creation as it is needed. After finishing Project is now created and you will have a hierarchical view just like below (if we have created application named test).
Hierarchical View of Application

Various Files In Android

  • src :- This folder contains the main core Activity file for the application being created. And the major work of coding goes into this folder.
  • gen:- These are automatic generated configuration file that will be used by the system.
  • res:- The Main designing part goes here in this folder. Here in various folders like drawable-hdpi and similar named folders hold the various images to be used by the application. Next it contains the folder layout where you will be defining the layout for different views of your application.
  • values:- This sub folder of res holds the different string.xml and other files for handling the data that will be referred in time to time in the application that is being developed.
  • AndroidManifest.xml will hold the values like the permission granting for internet access and some other system related requirements that will be additional.

Project Development

TestActivity is the file in case of application test where we will be spending most of our time in performing coding. The pre generated code for this particular file is as below. (Remember Android Programming is nothing but JAVA programming with API's and Android Additional services.)
So, If one knows java it is not going to be difficult to learn AP (Android Programming).


So in the next post we will come to the actual coding of this test application. Till then Good Byee!!





Saturday, October 13, 2012

Setting up Android with Eclipse


Eclipse is most widely used when it comes to use for Android Development. Following are the various phases that has to be done in order to install it and make necessary changes to setup with Android SDK .

Download and Install JDK
Download and install the latest JDK (JDK 1.6 Update 18) from JDK download page
Download and Install Eclipse IDE
Download and install Eclipse Classic 3.5 (Galileo) from Eclipse download page. You can also use the  Java or RCP version of Eclipse.
Download and Install Android SDK Starter Package
The Android SDK starter package includes only a single component, the latest version of the SDK Tools. Included in that component is a tool called Android SDK and AVD Manager that you can use to download other components from the SDK repository site.
  • Download the latest Android SDK  starter package  from the SDK download page.
  • Unpack the archive to a suitable location on your machine. By default, the SDK files are unpacked into a directory named  android-sdk- . For example, on Windows platform the directory will be android-sdk-windows.

Android SDK
Add Android Platforms to Your SDK
To add one or more Android platforms (for example, Android 1.6 or Android 2.1) to your SDK, use the Android SDK and AVD Manager, included in the SDK starter package. It is recommended  to download multiple platforms, so that you can build your application on the lowest version you want to support, but test against higher versions that you intend the application to run on.
  • Launch the Android SDK and AVD Manager on Windows by executing SDK Setup.exe at the root of the SDK directory. On Mac OS X or Linux, execute the android tool in the /tools/ folder.
  • On Available Packages menu, select the platforms to download (1.1 to 2.1).

If you find error on HTTP SSL while fetching the repository url , try to use http instead of https by checking the Force https://… sources to be fetched using http://… option on Settings menu.

Download and Installing Eclipse. Download it From here http://www.eclipse.org/downloads/

Download and Install ADT Plugin
To install  the ADT Plugin, you can take advantage of the Eclipse remote update feature. By setting up a remote update site, you can easily download, install, and check for ADT updates. Alternatively, you can download the latest ADT to your development computer as a local site archive.
  • Launch Eclipse, then select Help –> Install New Software.
  • In Available Software dialog, click Add
  • Enter a name for the remote site (ex: Android Plugin) in the Name field and in the Locationfield, enter this URL:
    https://dl-ssl.google.com/android/eclipse/
    and then click OK. If you have trouble acquiring the plugin, you can try using ‘http’  instead of  ’https’  in the URL.

Select the checkbox next to Developer Tools, which will automatically select the nested toolsAndroid DDMS and Android Development Tools and then click Next.
  • On the next dialog, click Next to read and accept the license agreement and install any dependencies, then click Finish.
  • Restart Eclipse
  • To check whether the ADT has been installed correctly, try to create a new project by selectFile > New > Project., you shoud find Android Project listed on project wizard.


Thursday, August 11, 2011

Installing Django on ubuntu

Hello Visitors, A Post after a long long time, currently I am getting my training at NIC Barnala for my degree course. I had done a project in php for NIC now I got bored from it and wanna shift to Some other framework or Scripting language. This time I selected Django framework based on python. Below are the steps to install it. The Project is a surprise :-

Install server software


Install Apache, Mod_Python, MySQL and MySQLdb. MySQLdb is the database bindings for MySQL. Django also supports PostgreSQL, Oracle and SQLite. If you choose to use a different database server, be sure to install the appropriate Python bindings.

sudo apt-get install apache2 libapache2-mod-python

sudo apt-get install mysql-server python-mysqldb

Install the Django source code

At this point you have a couple of options. You could “apt-get install” a Django package, install an official release or install the development version. I chose to install the development version because it contains the latest bug fixes and features. We’ll be checking out the latest version from its Subversion repository. You’ll want to be in your home directory when you do this.
cd ~/
svn co http://code.djangoproject.com/svn/django/trunk/ django_src

Python won’t recognize Django unless it is installed in the “site-packages” directory, so instead we just create a symbolic link to the source code in our home directory. Run the first command to find out the path to your “site-packages” directory. Then use it in the second command, in place of “YOUR-DIR”. Lastly, copy the django-admin.py file into /usr/local/bin so that we don’t have to qualify the command with the full path to the file.

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"



ln -s `pwd`/django_src/django YOUR-DIR/django



sudo cp ~/django_src/django/bin/django-admin.py /usr/local/bin

Create Django’s directories

Next we need to create some directories that Django will use. Once again, create these under your home directory.
cd ~/
mkdir django_projects



mkdir django_templates



mkdir media
Then we need to create some symbolic links in your webroot. The default webroot for an Apache2 installation on Ubuntu is /var/www. We are going to create a link to the media folder in your home directory, and a link to the admin_media folder which is provided in the Django source code.

cd /var/www



sudo ln -s  ~/media media



sudo ln -s ~/django_src/django/contrib/admin/media admin_media

Create a Django project

Move into your Django projects directory that we just created. We will be starting a new project using Django’s command line utility. This will give us a basic directory structure and the necessary configuration files. In my example I named the project “myproject.” Feel free to choose any name, as long as it does not conflict with any built-in Python or Django components. In particular, this means you should avoid using names like django (which will conflict with Django itself) or site (which conflicts with a built-in Python package).
cd ~/django_projects



django-admin.py startproject myproject
Edit the myproject/settings.py file and change the following sections:
  1. Uncomment and change the ADMINS settings:-

    6
    
    7
    
    8
    
    9
    
    10

    ADMINS = (
    
    
    
        ('Your Name', 'your_email@domain.com'),
    
    
    
    )


  2. Enter your database settings. You will need your database, username and password. Most likely your database server is running on the same server, so leave DATABASE_HOST blank.

    12
    
    13
    
    14
    
    15
    
    16
    
    17
    
    18
    
    19
    
    20
    
    21
    
    22

    DATABASE_ENGINE = 'mysql'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
    
    
    
    DATABASE_NAME = 'django_databae'             # Or path to database file if using sqlite3.
    
    
    
    DATABASE_USER = 'you'             # Not used with sqlite3.
    
    
    
    DATABASE_PASSWORD = 'yourpassword'         # Not used with sqlite3.
    
    
    
    DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
    
    
    
    DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.


  3. Change your timezone if necesary.


    19
    
    20
    
    21
    
    22
    
    23
    
    24
    
    25
    
    26
    
    27
    
    28
    
    29


    # Local time zone for this installation. Choices can be found here:
    
    
    
    # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
    
    
    
    # although not all variations may be possible on all operating systems.
    
    
    
    # If running in a Windows environment this must be set to the same as your
    
    
    
    # system time zone.
    
    
    
    TIME_ZONE = 'America/Chicago'


  4. Point Django at the template directory we created.


    69
    
    70
    
    71
    
    72
    
    73
    
    74
    
    75

    TEMPLATE_DIRS = (
    
    
    
    "/home/YOUR_USERNAME/django_templates"
    
    
    
       # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    
    
    
    )


  5. Do the same thing for the media url and directory we created earlier.


    36
    
    37
    
    38
    
    39
    
    40
    
    41
    
    42
    
    43
    
    44
    
    45
    
    46


    # Absolute path to the directory that holds media.
    
    
    
    # Example: "/home/media/media.lawrence.com/"
    
    
    
    MEDIA_ROOT = '/home/YOUR_USERNAME/media/'# URL that handles the media served from MEDIA_ROOT. Make sure to use a
    
    
    
    # trailing slash if there is a path component (optional in other cases).
    
    
    
    # Examples: "http://media.lawrence.com", "http://example.com/media/"
    
    
    
    MEDIA_URL = 'http://yourdomain.com/media/'


  6. Set the admin media directory that we created in your webroot


    45
    
    46
    
    47
    
    48
    
    49
    
    50
    
    51


    # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
    
    
    
    # trailing slash.
    
    
    
    # Examples: "http://foo.com/media/", "/media/".
    
    
    
    ADMIN_MEDIA_PREFIX = '/admin_media/'


  7. And finally, add the admin application to your install applications


    76
    
    77
    
    78
    
    79
    
    80
    
    81
    
    82
    
    83
    
    84
    
    85
    
    86
    
    87
    
    88


    INSTALLED_APPS = (
    
    
    
       'django.contrib.auth',
    
    
    
       'django.contrib.contenttypes',
    
    
    
       'django.contrib.sessions',
    
    
    
       'django.contrib.sites',
    
    
    
       'django.contrib.admin',
    
    
    
    )

After making all those changes to the configuration we need to synchronize the Django database. You�ll also get a prompt asking you if you�d like to create a superuser account for the authentication system. Go ahead and do that.

django-admin.py syncdb

Edit the URL configuration file and uncomment the admin line. This will allow you to access the admin section later.
nano ~/django_projects/myproject/urls.py

1

2

3


     # Uncomment this for admin:



    (r'^admin/', include('django.contrib.admin.urls')),


Configure Apache and mod_python


In Apache2 on Ubuntu, changes to the Apache configuration are done to the/etc/apache2/httpd.conf file. We are going to configure mod_python to handle requests for the root of the site and give control to Django. However, Django doesn’t serve media files itself; it usually expects you to have a different webserver serving these files. In our case though, we want Apache to handle it, so we need to turn off mod_python for some parts of the site. You will also need to do this if you have any other folders or scripts that you want excluded from Django’s control. In my example, I have phpMyAdmin, my media folders and any URL that ends with .jpg, .gif or .png be excluded.

When deploying Django sites on mod_python, you’ll need to restart Apache each time you make changes to your Python code. However, since I’m using this as a development server, I discovered a way to avoid the hassle of having to restart the server each time. At the top of my httpd.conf, I have the line MaxRequestsPerChild 1. This forces Apache to reload everything for each request. Do not use this setting on a production server!
The only other lines you need to change are in the firstblock. Change “myproject.settings”, if you are using a different name for your project. Then below that be sure to change the PythonPath to point to the django_projects folder in your home directory.
sudo nano /etc/apache2/httpd.conf


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36


MaxRequestsPerChild 1



   SetHandler python-program



   PythonHandler django.core.handlers.modpython



   SetEnv DJANGO_SETTINGS_MODULE myproject.settings



   PythonPath "['/home/YOUR_USERNAME/django_projects'] + sys.path"



   SetHandler None



   SetHandler None



   SetHandler None



   SetHandler None

Restart Apache

sudo /etc/init.d/apache2 restart
You can now view your new Django website by visiting the root of the website you installed it at – http://yourdomain.com/ . You should see a Page not Found (404) error message generated by Django. Congratulations! Everything is working. You can also go to http://yourdomain.com/admin/ and log in with the superuser you created earlier.

Now that you’re done with the easy part, all thats left is to get started writing your Django apps. There is a tutorial on the official Django website that will walk you through creating an application.

Thursday, September 2, 2010

Installing GIMP Scripts

First you have to decide if you are going to make this script available for all users as a Global script or just a single user as a local script. If you don't have access to create files in the Global location then you can only install them as a local script.

Microsoft Windows and Linux use different file system structures so they require you to save the files in completely different locations. The default file locations are as follows:

Windows


  • User: Download the file to C:\Documents and settings\\.gimp-2.2\scripts
  • Global: Download the file to C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts
Linux

  • User:Download the file to ~/.gimp-2.2/scripts
  • Global:Download the file to /usr/share/gimp/2.0/scripts

Where did the script go?

Often you have just installed the script and now you can't find it. There are several reasons for this and I will explain how to find the new script.

First, when GIMP starts it reads both the Global and user script locations. So if you have added the script while The GIMP was running you will not see it, yet. One solution is to close GIMP and re-open it allowing it to read and add the new script. Another is to manually tell GIMP to read the script locations while it is still running. To do this just go / Xtns / Script-Fu / Refresh scripts

Ok, GIMP has read the script where do I find it?

GIMP scripts can be placed by the author anywhere they want. The two main locations are in the main GIMP window or in the menus in the Image window.

As a general rule scripts that alter the image are placed on the image menus and ones that create a new image from scratch are placed in the menus on the main GIMP window.

Wednesday, August 25, 2010

How to turn a jpeg image into a sketch in Gimp

  1. Start gimp on your computer and load the jpeg image you'd like to work with into the gimp.
  2. Go to colors; then desaturate-average.
  3. Go to filter and select edge.
  4. Now, got to colors and select invert.
  5. You now have a sketch of your photo. Now go to colors, then levels and play with the values until you are satisfied with the intensity of the sketch.
  6. Save your image and your done!

Saturday, August 14, 2010

Activating the User's public_html Directory with userdirectory (Using Apache2 )


Create a directory (folder) called "public_html" in your home directory, with your file browser or the command below. Do NOT use the sudo command.
me@myhost$ mkdir public_html

I have found that on a simple development machine, it is easier to have your work all within your own home directory and not have to worry about permissions and folders owned by the root user. What it gets you is the ability to access your websites in your home directory by a URL in the form http://localhost/~USER_NAME. We can improve upon this with fake domains, but first things first.
There are only two commands you need to enter to activate the User Directory feature, and then one command to reload the configuration files. The last command includes an absolute path, so it doesn't matter where you execute it from. The first two "ln" commands assume you are in the directory /etc/apache2/mods-enabled. What you need to do is create two symbolic links (soft links, symlinks) in the stated directory pointing to the corresponding module in /etc/apache2/mods-available. So, if "$" is your prompt,
me@myhost$ cd /etc/apache2/mods-enabled
me@myhost$ sudo ln -s ../mods-available/userdir.conf userdir.conf
me@myhost$ sudo ln -s ../mods-available/userdir.load userdir.load
me@myhost$ sudo /etc/init.d/apache2 restart
me@myhost$ sudo gedit /etc/apache2/mods-available/php5.conf
you will see a file like the one below :



SetHandler application/x-httpd-php


SetHandler application/x-httpd-php-source

# To re-enable php in user directories comment the following lines
# (from to .) Do NOT set it to On as it
# prevents .htaccess files from disabling it.


php_admin_value engine Off




Now change it to look like the one below and then save it :



SetHandler application/x-httpd-php


SetHandler application/x-httpd-php-source

# To re-enable php in user directories comment the following lines
# (from to .) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#
#
#php_admin_value engine Off
#

#

#



Sunday, August 8, 2010

Red Eye Removal using Gimp

See an example of red eyed picture over here::
chris  and tori with red eyes
Launch GIMP and then open your photo. Select the rectangle tool.
    gimp  rectangle tool
    Draw a rectangle around the red eyes.
gimp  rectangle tool selecting red eyes
Now select Filters -> Enhance -> Red Eye Removal…
    gimp filter  for removing red eye
    The Red Eye Removal tool will pop up. Use the Threshold scroll bar to adjust the eye color as you see fit. Click OK when you’re done.
gimp  red eye removal threshold
The changes will be applied to your photo.
    gimp  red eye removal
    Use the Zoom feature if you need to remove red eyes from someone who also has red hair (or a wig
    ) that’s getting in the way. You can even select one eye at a time.
      gimp  red eye removal closeup
      And the finished product –
      no  more red eyes

Sunday, August 1, 2010

Problems during Compilation of LaTeX files

Hello to all, I am sorry for not posting this message earlier. But when Now I prepared my synopsis and make its template and send to others then I came to know that i forgot to tell about how to include extra packages to be used in LaTeX file.

For that you just need to create directory structure as shown below in your home folder:
/home/username/texmf/tex/latex
and after that now you have to install extra packages. Note down .sty file error which terminal gives you when you are compiling your .tex file. Now search the Internet for that .sty file named package like if I have demo.sty file error then I will look for demo latex package. After you download this package you need to install it on the system. Just placed the folder(demo say) under latex folder. Then go to terminal & type:
$sudo -s
#cd /texmf/tex/latex
#texhash demo(in place of demo you can have package name)
That's it file will be updated and your package will be installed.

Thursday, July 8, 2010

Installing O3space on your linux system

I am making here documentation for how to install o3workspace so that any visitor on this site can have full fledge process of installation, otherwise one has to wander from one site to another as i did.

1) first of all you need to have O3spaces.deb package . For that just go to www.o3spaces.org. There you find Register section Register under Communtiy edition (it is completely free).After Go to your mail activate your account on o3space. as soon as account is activated you will get another mail having username and password.With this username and password log on to o3spaces and after that download .deb package.
2) For O3space to work you need sun-java-6-jdk and sun-java-6-jre.
To install it Got to terminal and type:
$sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$sudo apt-get update
$sudo apt-get install sun-java6-jdk
3) After that follow step and when installed. Go to Application Menu then System and open java console and enable a server either localhostor remote one.
4)After that run o3space.deb package to install your o3space on ubuntu.
after completion. Go to browser type http://localhost:8095/Spaces or type
http://localhost:8095/Studio (Command line is here for o3spaces).You will something see like this when use Spaces.

You can also change your ip from localhost to your own ip. Means you can also have http://myip:8095/Studio or http://myip:8095/Spaces. So, For that you first need to shutdown your tomcat server. With o3spaces.deb tomcat get installed simultaneously.
For shutdown Go to terminal and type:
$sudo -s
#cd /opt/O3Spaces/tomcat/bin
#./shutdown.sh
But remember before executing script ./shutdown.sh you need to do some changes in shutdown.sh
#gedit /opt/O3Spaces/tomcat/bin/shutdown.sh
Caution!!find somewhat written like sun-java-1.6.3. and replace it by sun-java6-jdk Save it same changes you need to make it in startup.sh also.
This will stop your tomcat. After that go to terminal again and type.
#gedit /opt/O3Spaces/tomcat/conf/server.xml
Here find localhost and replace it with your server domain and then restart tomacat server. And then you can access o3spaces from your desired ip.

Wednesday, June 23, 2010

Using pdfscreen package in LaTeX

Today i am going to discuss with you that how you are able to get both print form and screen viewable document by changing single option in this pdfscreen package. You just need to include following code in preamble part:-

\documentclass[a4paper,11pt]{article}
\usepackage{xspace,colortbl}
\usepackage[screen,panelleft,gray,paneltoc,sectionbreak]{pdfscreen}
\margins{.75in}{.75in}{.75in}{.75in}
\screensize{6.25in}{8in}
\overlay{lightsteelblue.pdf }
\begin{document}
in the very third line if you change screen to print format it will make a form called print which acts as your report format.
\screensize is used when you need to view it on your screen or in short you can say that you want to make presentation.
\sectionbreak is used so that a pagebreak can be inserted in your screen view after you write each section.
If you want to view example click on PRINT and SCREEN
But let me clear you one thing if you are going to compile it on texmaker it will surely give you problem you may try but each time you will not get desired
output see my output which i got when i was using texmaker SEE.
So, from my this experience i will prefer to use console mode for tex compilation rather than gui softwares for compiling tex files.
So, follow the same command which i discussed on the JUNE 4 i.e.
using command $pdflatex file.tex
Then you will get desired output. Also preferably use Acro reader in ubuntu to view your pdf files.