Linux


Salam all,

i have downloaded some videos in wmv format and i needed to convert them into mp3 to play on my mp3 player. after searching google for how to do this on ubuntu i found a solution:

– first install lame and mencoder:

$ sudo apt-get install lame mencoder

– Run mencoder command to convert wmv file to mp3 file:

$ mencoder audioFileName.wmv -oac mp3lame -ovc frameno -of rawaudio -o audioFileName.mp3

    it is too straight and too easy. enjoy your mp3s.

    Advertisements

    some times you need to copy a file or directory from your machine to another machine using command line, if so you can use the scp command :

    suppose that the file needed to be copied /home/mostafa/file.txt, and you have access to the other machine mostafa@nile-sys.com

    $ scp /home/mostafa/file.txt  mostafa@nile-sys.com:/home/mostafa/

    this command will copy the file.txt to the the path /home/mostafa/file.txt in the remote machine nile-sys.com

    also you can copy files between 2 remote machine with the same command as follows:

    $ scp mostafa@www.nile-sys.com :/home/mostafa/file2.sh mostafa@ns1.nile-sys.com:/home/mostafa

    when you are using tomcat as you application server for not small application you can easy get (out of memory exception). this is because the default heap size tomcat use is small and suitable only for small web applications.

    to set the start and maximum heap size run the following command before starting your tomcat:

    export CATALINA_OPTS=”-Xms256m -Xmx512m”

    or

    export JAVA_OPTS=”-Xms256m -Xmx512m”

    this will create environment variable called CATALINA_OPTS  or JAVA_OPTS contains the required options to make tomcat start heap size 256M and maximum heap size 512M.

    In this post I’ll talk about how to use connection pooling in struts running on tomcat server:

    you will need to edit in the following places:

    • META-INF/context.xml
    • WEB-INF/web.xml

    first you need to add a context.xml file to your application to be used by tomcat application server when defining and creating your application context.

    To do that create a folder called META-INF beside your WEB-INF.

    in this folder create file and name it context.xml

    open this file and add the following code:

    <Context path=”/yourAppPath” docBase=”yourAppDocBase
    debug=”5″ reloadable=”true” crossContext=”true”>
    <Resource name=”jdbc/resourceName” auth=”Container” type=”javax.sql.DataSource”
    maxActive=”100″ maxIdle=”10″ maxWait=”10″
    username=”userName” password=”Password” driverClassName=”com.mysql.jdbc.Driver”
    url=”jdbc:mysql://localhost:3306/DatabaseName?autoReconnect=true”/>
    </Context>

    replace names in Bold with your application parameters resourceName is the name of the datasource that you will use. the previous code creates a new database resource on your application context.

    now you need to create a reference to the created resource. edit your web.xml and add the following code:

    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/resourceName</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>

    replace names in Bold with your application parameters.

    now you only need to know how to get the datasource from your code:

    Context ctx = new InitialContext();

    DataSource ds = (DataSource) ctx.lookup(“java:comp/env/jdbc/resourceName“);

    Connection connection = ds.getConnection();

    and you can enjoy using the new connection

    I wish that I made this topic clear and I’ll be happy to receive your comments and questions.

    Hello every one,

    few days ago my ubuntu machine started to give me this error every  time i login:

    ISD-Server could not start because port 5800 is not available.

    i google it but didn’t found a good solution but after while i found one from ubuntu forum:

    ica is part of italc.sourceforge.net and it is installed on my machine when i installed edubuntu.

    and to stop getting this error message here is what i did:

    $sudo apt-get remove libitalc italc-client italc-master

    and i never see the error message again.

    here is the thread which i found the solution in:

    http://ubuntuforums.org/showthread.php?t=749394&page=2

    sometimes i needed for a desktop dictionary on ubuntu linux, now i found how to setup the arabic dictionary in the linux Dictionary:

    for gnome :

    – open Applications Menu -> Accessories -> Dictionary.

    – the Dictionary application is opened. now click edit menu and select Preferences.

    – in the source tab click Add button.

    – A new window opened, in the Description field write: Arabic Dictionary. or whatever you want to name it.

    – let Transport select box as Transport.

    – Hostname : dict.arabeyes.org

    – Port: 2628

    now enjoy using the desktop dictionary.

    now i’ll explain how to install ubuntu without using cdrom and with a usb flash memory:

    a usb flash memory by default is formatted in vfat file system, i will not change the file system type.

    – first you need to create a master boot record in the flash memory

    $ sudo parted /dev/sdb set 1 boot on

    you need to change sdb to you usb device, you can know what is the link to your device from the command mount

    now you have a bootable usb storage device all what you need next is to copy the kernel and init parameters file in the suitable place in your flash memory.

    – create a directory named casper in root of your flash memory.

    – download the following files and put them in the directory named casper

    1- http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/hd-media/vmlinuz

    2- http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/hd-media/initrd.gz

    – get the iso image which will be used to install ubuntu, you need to download the alternative CD not the normal cd.

    – extract the iso image and copy the folder isolinux from the extracted iso to the root of usb flash memory.

    – rename the isolinux folder in the root of the flash memory to syslinux.

    – inside the syslinux folder rename the file isolinux.cfg to syslinux.cfg

    – copy the alternative cd iso image -not the extracted folder- to the folder casper on the flash memory.

    everything now is fine and you can reboot that machine and boot from the usb flash memory then install ubuntu.

    enjoy.

    Next Page »