Friday, December 16, 2011

How to create a .jar file


Java Archive (JAR) files allow developers to package many classes into a single file. JAR files also use compression, so this can make applets and applications smaller.
Creating a .JAR file is easy. Simple go to the directory your classes are stored in and type :

jar -cf myfile.jar *.class

If your application or applet uses packages, then you'll need to do things a little differently. Suppose your classes were in the package mycode.games.CoolGame - you'd change to the directory above mycode and type the following :- (Remember to use / on UNIX systems)

jar -cf myfile.jar .\mycode\games\CoolGame\*.class

Now, if you have an existing JAR file, and want to extract it, you'd type the following

jar -xf myfile.jar

Working with JAR files isn't that difficult, especially if you've used the unix 'tar' command before.  If you're planning on packaging an applet for Internet Explorer, or an application for Microsoft's jview, you might also want to consider .CAB files.

Monday, October 24, 2011

Joomla Unix Folder Permissions

chmod 777 administrator/backups/ administrator/components/ administrator/language/ administrator/language/en-GB/ administrator/modules/ administrator/templates/ components/ images/ images/banners/ images/stories/ language/ language/en-GB/ language/pdf_fonts/ modules/ plugins/ plugins/content/ plugins/editors/ plugins/editors-xtd/ plugins/search/ plugins/system/ plugins/user/ plugins/xmlrpc/ tmp/ templates/ cache/

Tuesday, October 18, 2011

Create or extract tar files in ubuntu using terminal command


Ubuntu applications comes as tar packages, so if you want to create or extract tar files you should know the command of doing this

working with tar files in ubuntu

Create tar file

$ tar -cvf filename.tar filename

Extract tar file

$ tar -xvf filename.tar
To extract tar file with gz extension use
$ tar -xvf filename.tar
Meanings to commond tar command flags are given below
- Create a new archive.
t – List the contents of an archive.
x - Extract the contents of an archive.
f – The archive file name is given on the command line (required whenever the tar output is going to a file)
M – The archive can span multiple floppies.
v - Print verbose output (list file names as they are processed).
u – Add files to the archive if they are newer than the copy in the tar file.
z – Compress or decompress files automatically.

Installing PHP5 and Apache2 on Ubuntu


If you are doing any kind of PHP development, you’ll almost always be using Apache along with it. Here’s the quick and easy way to get PHP up and running on your Ubuntu box.
From a command shell, you will run the following commands:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Note that if apache is already installed you can omit the first line. Your web files will now be found in /var/www/

    Tuesday, October 11, 2011

    Mount EBS Volume in Ubuntu


    Using EBS volume can decrease risk of server crash suddenly or "permission denied" problem in EC2 server. The logic, after we create instance store, we create new EBS volume which we can set the capacity as we need. In this cases, i create 60GB EBS and will using it as /var in instance store. Now, let configure our EC2 and using EBS as indepent storage.
    1. Create EBS Volume and attach it into instance store in EC2 panel management. Use same region, ex : east-1b
    2. Login into instance store SSH.
    3. In my configuration, EBS Volume located in /dev/sdg. So remember what yours.
    4. Use sudo fdisk -l to see if your EBS already attached
    Disk /dev/sdg: 64.4 GB, 64424509440 bytes
    255 heads, 63 sectors/track, 7832 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    5. Formating EBS Volume so we can use it by sudo mkfs -t ext4 /dev/sdg and you will get result :
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    3932160 inodes, 15728640 blocks
    786432 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    480 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424
    This will takes a long time, like 10-30 minutes.
    6. Edit /etc/fstab and add this :
    /dev/sdg        /var    auto    defaults,nobootwait,noatime     0       0
    and reboot from EC2 panel management. Now, you use EBS for all installed program and www.

    Thursday, September 22, 2011

    Add Polls or Modules to Articles in Joomla!

    1) Go to Module Manager
    2) Select the poll you want to load.
    3) Rename the position by typing in a unique reference, eg. poll_16. (I didnt realise you could type in that field)
    4) Go to Article Manager
    5) Edit your article and where you want to insert the poll, type: {loadposition poll_16}
    6) Click save/apply.

    Wednesday, September 21, 2011

    Use Network Drive with Mac Time Machine


    1. Mount your network drive (check step-5 if you are getting error in mounting)
    2. Change the preferences by running following command (open iTerm or other shell)
    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
    3. Now activate the time machine
    4. You will now be able to select your network drive.
    5. In case, you loose your network mount, you will need to reset the preference set in step-2, by running following command (open iTerm or other shell)
    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 0
    For more detail, read this