Friday, October 28, 2011

how can i unzip rar. files

open terminal

apt-get install unrar

then .rar files can extract normal way.

Tuesday, October 18, 2011

How to move mysql database to another drive or partition

First copy database to current mysql directory
(my source directory is /home/viranga/mysql1/ and destination is /var/lib/mysql/ )

 sudo cp -r /home/viranga/mysql1/database /var/lib/mysql/database

Give permission  to it.
sudo  chown -R mysql:mysql /var/lib/mysql/database





Friday, September 23, 2011

Cannot find codeigniter spark path at sparks

1st issue:
sparks not installed successfully.
reinstall sparks


    Steps:
  1. Via the shell, navigate to the root of your CodeIgniter application
  2. Copy and paste the following into the command line:
php -r "$(curl -fsSL http://getsparks.org/go-sparks)"
  1. Press enter. If all goes well, move on to Get Sparks. If not, try the normal installation below.



2nd issue:
if you use public folder for index.php, CI application cann't find sparks.


Steps:
go to the site_root/application/core/MY_Loader.php

Default constructor

function __construct() { 
   if(!defined('SPARKPATH')) 
   { 
      define('SPARKPATH', 'sparks/'); 
   } 
   parent::__construct(); 
}


modify highlighted row to

define('SPARKPATH', '../sparks/');


Friday, September 16, 2011

.htaccess not working on localhost.(LAMP)


if u want to check mod re-write enable
sudo a2enmod rewrite
view apache error log
tail -f /var/log/apache2/error.log
open default file
sudo gedit /etc/apache2/sites-available/default

replace AllowOverride None to AllowOverride All

restart apache

sudo apache2ctl restart

Thursday, September 15, 2011

How to enable curl support with PHP (for ubuntu)

Run following command in terminal
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

Monday, September 12, 2011

How to install Eclipse 3.7 on Ubuntu 11.04

The Eclipse packages in Ubuntu are are very out of date. The latest version in the Ubuntu repos is 3.5.2 where as the latest version of Eclipse is 3.7. I’m posting this because Ubuntu 11.04 uses the new Unity desktop which uses overlay-scrollbars (scrolls bars that are hidden until you hover over them). For some reason Eclipse 5.3.2 doesn’t like to play nice with the overlay scrollbars, and I’d rather use the newest version anyways. With Eclipse, you can just download the tar.gz file from eclipse.org and run it no problem, but I like set things up in a cleaner fashion, so here’s how I did it.

 1) Download Eclipse. I got eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz
2) Extract it
tar xzf eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz
Or just be lazy and Right Click > Extract Here
3) Move to /opt/ folder
mv eclipse /opt/
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse
4) Create an eclipse executable in your path
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo nano /usr/bin/eclipse
copy this into nano
#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*
save the file (^O = Ctrl+o) and exit nano (^X = Ctrl+x)
5) Create a gnome menu item
sudo nano /usr/share/applications/eclipse.desktop
copy this into nano
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
save and exit nano
6) Launch Eclipse for the first time
/opt/eclipse/eclipse -clean &

Wednesday, September 7, 2011

Useful commands for ubuntu

For read apache error log

tail -f /var/log/apache2/error.log

get apptitude

sudo apt-cache search aptitude

sudo apt-get install aptitude

sudo aptitude search rewrite

enable rewrite engine

sudo a2enmod rewrite

Monday, September 5, 2011

Setting up Virtual Hosts with XAMPP running on Windows XP


Setting up virtual hosts with XAMPP is very straight forward and could be done in less than 5 minutes. Although, your local XAMPP server will still work even if virtual hosts are not configured. You might want to ask, is there a need for my local XAMPP setup to configure virtual hosts? Apparently, virtual hosts are needed when

  • your on multiple domains
  • your need to test your projects with same configuration with the server
  • test your projects without touching your public server
  • your just organizing your projects into groups
  • or setup a local copy of your blog or website
What do we need?
This document assumes that you are working with Windows XP with XAMPP. If you don't have XAMPP, get it at their XAMPP for Windows download page. Just execute the exe file and follow the onscreen instructions.

Configuring Windows XP to accept hosts
Hosts is a file under Windows XP that is used to map IP addresses to a custom list of hosts or maybe domain names. The IP address should be placed in one line. The first column should contain the IP address and on the second column its corresponding hostname. The IP address may be separated by a space or by a tab. You can place comments by prepending your line this symbol '#' (pound sign). Initially the first line is added. Now lets add our domain tildemark.com

127.0.0.1       localhost
127.0.0.1       www.tildemark.com
127.0.0.1       tildemark.com

you can check your work by doing a ping to your configured host.


Configuring XAMPP to accecpt Virtual Hosts
  1. Got to your Apache folder in XAMPP and locate the conf files. The are usually located at <<local path>>\xampp\apache\conf\extra
  2. Open the file named httpd-vhosts.conf with a text editor
  3. If posible read the instructions so may have the idea on what you are doing
  4. Now paste the following code at the bottom of the file without touching the document.

    NameVirtualHost 127.0.0.1:80
    <VirtualHost 127.0.0.1:80>
      DocumentRoot E:/xampp/htdocs/    # change this line with your htdocs folder
      ServerName localhost
    </VirtualHost>
  5. Edit the line DocumentRoot with your own document root folder
  6. For each domain you are to configure paste the following lines below, just replace my domain name your corresponding domain:
<VirtualHost www.tildemark.com>
  DocumentRoot "E:\www\www.tildemark.com"
  ServerName www.tildemark.com
  ServerAlias www.tildemark.com

  CustomLog "E:\www\www.tildemark.com\www.tildemark.com-access_log" combined
  ErrorLog "E:\www\www.tildemark.com\www.tildemark.com-error_log"

  <Directory "E:\www\www.tildemark.com">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Tuesday, August 30, 2011

CodeIgniter – No input file specified error – .htaccess – PHP5 – Apache 2

simply i used following .htaccess code


RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]


difference of below code and codeigniter documentation code is "?" of third row. i highlighted it.


How to setup virtual host in ubuntu

Step 1: setup a virtual domain
open /etc/hosts and add a virtual domain with a specific local IP. In this file it contains ip and domain name separated by a space. You can also add the port using a colon with the IP. Lets assume that our virtual domain name is “domain.local” – and It will listen to the ip “127.0.0.1″

so we will add the following line to our /etc/hosts file
127.0.0.1 domain.local

now whenever you point to http://domain.local – your browser will actually open http://127.0.0.1

Step 2: configure virtual host with apache

here we will configure our newly added virtual domain against apache as a virtual host, and did I forget to say, with mod_rewrite enabled :)
goto /etc/apache2/sites-available and create a file named “domain.local” – I recommend to keep it the same name as your virtual domain.
sudo gedit /etc/apache2/sites-available/domain.local
write the following contents inside. but please note to create the appropriate directory before linking your virtual host with that, for example we’ve create a folder named “/var/www/domain” and linked that directory as my document root in the following configuration file.

<VirtualHost *:80>
ServerName domain.local
DocumentRoot " /var/www/domain"
DirectoryIndex index.html index.php

<Directory " /var/www/domain">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

now create a symbolic link of this file to /etc/apache2/sites-enabled directory as “domain.local”
sudo ln -s /etc/apache2/sites-available/domain.local /etc/apache2/sites-enabled/domain.local

Step 3: restart apache (or reload)
simple, either one of the followings
sudo /etc/init.d/apache2 restart
or
sudo /etc/init.d/apache2 reload
and you are done! now you can point your browser to http://domain.local


Wednesday, March 30, 2011

How to Install Firefox 4 in Ubuntu Linux


Earlier today, we reported that Firefox 4 has just been released. Why do you need instructions to install the newest Firefox in Ubuntu? If you go into your Ubuntu Software Center, you’ll see that you more than likely have Firefox 3.6 installed, and it’s “up to date”. Naturally, they don’t add programs to the Software Center as soon as they are released. That would be foolish if there was something wrong with the new version. I don’t blame them for waiting at least a few days for the adventure seekers to provide some feedback.
There are three ways that I know of to add the newest Firefox to Ubuntu.
firefox 4

Method 1: Download Bzipped Package

You can go to the Firefox download page, download the TAR.BZ2 package and manually install it. The advantage of that method is that you won’t lose the current version 3.6 of Firefox. However, you’ll have to unpack the BZ2 file to a folder somewhere, locate the “firefox” executable file, then double click to launch it. If you’d like to, you can also create your own launcher link on the desktop or add it to a panel.

Method 2: Command Line Install

You can add the Firefox “Stable” repository and install the latest version from the command line in a terminal window. That’s actually the easiest method for most linux users. Here are the three simple commands you need to enter into the terminal.
sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get update
sudo apt-get upgrade

Method 3: Software Center Install

Open your “Ubuntu Software Center” and click “Edit” > “Software Sources” then click the ‘Other Software’ tab. Add the PPA as shown below. When you exit the “Software Sources” applet, your Software Center will reload the repositories and it may even automatically find the updated Firefox for you.
ppa:mozillateam/firefox-stable
add firefox stable ppa to the software center




Sunday, March 27, 2011

Ubuntu Linux Configure DNS Name Server IP Address ( DNS Client )

Type the following command, enter:
sudo gedit /etc/resolv.conf

Append your ISP name server or free fast dns nameservers IP address as follows:
nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 202.51.5.52



or
Use Google DNS


8.8.8.8
8.8.4.4

Wednesday, March 23, 2011

.htaccess & .htpasswd Files not Working in ubuntu

My solution to solve this is change /etc/apache2/sites-available/default

sudo vi /etc/apache2/sites-available/default
or
sudo nano ....
depending on your preference


You see something like:
Code:
<directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

Change this to:
Code:
<directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
and restart apache (sudo /etc/init.d/apache2 force-reload) and you see the .htaccess file is read and you are required to enter a username/password

Monday, February 28, 2011

Places menu starts Rhythmbox 0.11.6, doesn't open folder

Simple workaround

Right click -> Open with -> custom command -> nautilus

repeat for all folders

now should open folders from Places in Nautilus

Monday, February 21, 2011

How to install flash debugger

උබුන්ටු වලදි  firefox වලට flashfirebug install කරාට පස්සෙ එක වැඩ කරන්න flash debugger එක ඉල්ලනවා. flash debugger eka install කර ගන්නෙ මෙහෙමයි.

Step by step:
  1. uninstall any kind of flash plug you have at the moment, make sure it's gone. (this was my problem, probably had the real 64 bit plug installed and there were multiple libflashplayer.so spread all over the place. Make sure you clean out any flash plugin related files from your system)
    search for installed flashplugin packages:
    Code:
    aptitude search flash
    p   flashblock                                                - mozilla extension that replaces flash elements with a button        
    i A flashplugin-installer                                     - Adobe Flash Player plugin installer                                 
    i   flashplugin-nonfree                                       - Adobe Flash Player plugin installer (transitional package)          
    p   flashrom                                                  - Universal BIOS/ROM/flash programming utility                        
    p   flashybrid                                                - automates use of a flash disk as the root filesystem                
    p   libroxen-flash2                                           - Flash2 module for the Roxen Challenger web server                   
    p   m16c-flash                                                - Flash programmer for Renesas M16C and R8C microcontrollers          
    p   vrflash                                                   - tool to flash kernels and romdisks to Agenda VR
    you will get a list of packages with flash in the package name, remove them from your system.(flashplugin-nonfree, flashplugin-installer) using the command: sudo apt-get purge [PACKAGE NAME], e.g. sudo apt-get purge flashplugin-nonfree
    I always do sudo apt-get autoremove after purge, to get rid of remaining junk, not sure if it's important, but it feels good
  2. install the flash plugin using the command: sudo apt-get install flashplugin-nonfree
  3. download the debug player from Adobe: http://download.macromedia.com/pub/f...nux_dev.tar.gz
    if they moved the file google for: flash debug player linux
  4. replace the installed shared object file /usr/lib/flashplugin-installer/libflashplayer.so with the one you downloaded.

Friday, January 28, 2011

Google Talk and Pidgin

Settings:-


Basic Tab
protocol : xmpp
domain : googlemail.com
resource : Home


Advanced Tab
Require SSL/TLS, Force old port (5222), Allow plain text .... : All Unchecked
Connect Port: 5222
Connect Server: talk.google.com
File Transfer Proxies : proxy.jabber.org