Thursday, January 27, 2011

How to assign different prices per website in magento

Go to System -> Configuration -> Catalog -> Price and change scope to “Website”. You may now set different pricing per website.

Wednesday, January 26, 2011

Updating WordPress

http://codex.wordpress.org/Updating_WordPress

Check Requirements

Whatever the reason for updating, before getting started it is best to check the current minimum requirements page first to make sure that your web host has the required versions of PHP and MySQL. (If you are not sure, then your hosting provider should be able to tell you.)

Take a Backup

The next thing to do is to take a backup of your database. All your posts and Pages are held in the database, so you will need to have a copy of it in case, for whatever reason, you change your mind after upgrading and need to go back. If you are not sure how to backup your database, then complete instructions can be found in the WordPress Backups section of the Codex.

Disable Plugins

The final preparation step is to disable plugins. Now, you don't have to do this, but every now and again a plugin hasn't been updated to work with the latest version of WordPress, and causes a problem after the upgrade. So, it's best to try and avoid that, yes? You can easily disable your plugins by heading to the Manage Plugins page in the Dashboard, changing the "Bulk Actions" pull down menu to "Deactivate" and clicking "Apply".

Ready to Update

Now that you've checked that you're ready to update, you've turned off your plugins and you've got your backup, it's time to get started.
There are two methods for updating - the easiest is the Automatic Update, which will work for most people. If it doesn't work, or you just prefer to be more hands-on, you can follow the manual update process.

Automatic Update

Current versions of WordPress (2.7+) feature an Automatic Update. You can launch the automatic Update by clicking the link in the new version banner (if it's there) or by going to the Tools -> Upgrade (or Update for version 3) menu.
Once you are on the "Update WordPress" page, click the button "Update Automatically" to start the process off. You shouldn't need to do anything else and, once it's finished, you will be up-to-date.
Note that your files all need to be owned by the user under which your Apache server executes, or you will receive a dialog box asking for "connection information," and you will find that no matter what you enter, you won't be able to update. See man chown. If you do not know which user runs the httpd the output of ps auxw | grep -E 'http|apache|www' or ps auxw might help, see man ps.
Automatic update has been known to fail if you're not using PHP5. If you see the message indicating that the update is downloading the zip file and then nothing else happens, it may be because you are not running PHP5. Many hosts offer both PHP4 and PHP5, and switching is usually very easy, often a simple entry in your .htaccess file. If you can't switch to PHP5, and experience this problem, use the manual update below.
If you have customized the default or classic themes without renaming them, you should not use the automatic upgrade, as it will overwrite your changes - you should use a manual update instead.
If the automatic upgrade doesn't work for you, don't panic, just try a manual update.

Manual Update

These are the short instructions, if you want more check out the extended upgrade instructions. If you experience problems with the Three Step Update, you may want to review the more detailed upgrade instructions
For these instructions, it is assumed that your blog's URL is http://example.com/wordpress/.

Step 1: Replace WordPress files

  1. Get the latest WordPress zip (or tar.gz) file.
  2. Unpack the zip file that you downloaded.
  3. Delete the old wp-includes and wp-admin directories on your web host (through your FTP or shell access).
  4. Using FTP or your shell access, upload the new wp-includes and wp-admin directories to your web host, overwriting old files.
  5. Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).
  6. Upload all new loose files from the root directory of the new version to your existing wordpress root directory.
NOTE - you should replace all the old WordPress files with the new ones in the wp-includes and wp-admin directories and sub-directories, and in the root directory (such as index.php, wp-login.php and so on). Don't worry - your wp-config.php will be safe.
Be careful when you come to copying the wp-content directory. You should make sure that you only copy the files from inside this directory, rather than replacing your entire wp-content directory. This is where your themes and plugins live, so you will want to keep them. If you have customized the default or classic themes without renaming them, make sure not to overwrite those files, otherwise you will lose your changes. (Though you might want to compare them for new features or fixes..)
Lastly you should take a look at the wp-config-sample.php file, to see if any new settings have been introduced that you might want to add to your own wp-config.php.

Step 1.5: Remove .maintenance file

If you're upgrading manually after a failed auto-upgrade, delete the file .maintenance from your WordPress directory using FTP. This will remove the "failed update" nag message.

Step 2: Update your installation

Visit your main WordPress admin page at /wp-admin. You may be asked to login again. If a database upgrade is necessary at this point, WordPress will detect it and give you a link to a URL like http://example.com/wordpress/wp-admin/upgrade.php. Follow that link and follow the instructions. This will update your database to be compatible with the latest code. You should do this as soon as possible after step 1.

Step 3: Do something nice for yourself

If you have caching enabled, your changes will appear to users more immediately if you clear the cache at this point (and if you don't, you may get confused when you see the old version number in page footers when you check to see if the upgrade worked).
Your WordPress installation is successfully updated. That's as simple as we can make it without Updating WordPress Using Subversion.
Consider rewarding yourself with a blog post about the update, reading that book or article you've been putting off, or simply sitting back for a few moments and letting the world pass you by.

Final Steps

Your update is now complete, so you can go in and enable your Plugins again. If you have issues with logging in, try clearing cookies in your browser.


Troubleshooting

If anything has gone wrong, then the first thing to do is go through all the steps in our extended upgrade instructions. That page also has information about some of the most common problems we see.
If you experience problems after the upgrade, you can always restore your backup and replace the files with ones from your previous version from the release archive.

Monday, January 24, 2011

Checking if PEAR works

Verifying command line tool

Both pear and pecl tools should be available everywhere on command line. For that to work, pear's binary (bin) directory should be in your PATH variable.
To verify it works, simply type pear. A list of commands should be shown:
$ pear
Commands:
build                  Build an Extension From C Source
bundle                 Unpacks a Pecl Package
channel-add            Add a Channel
...
You should further test that PEAR is up to date:
$ pear version
PEAR Version: 1.7.2
PHP Version: 5.2.6RC4-pl0-gentoo
Zend Engine Version: 2.2.0
Running on: Linux ...

Verifying the include path

To use PEAR and PEAR compatible packages in your applications, you normally include them into your PHP scripts using require_once(). For this to work, PEAR's php_dir must be a part of PHP's include path.
  1. First, check where PEAR installs .php files:
    $ pear config-get php_dir
    /usr/share/lib/php/
    This directory will contain System.php.
  2. Now it's time to find which configuration file is used by your PHP installation. On command line, execute:
    $ php --ini
    Configuration File (php.ini) Path: /etc/php/cli-php5
    Loaded Configuration File:         /etc/php/cli-php5/php.ini
    Scan for additional .ini files in: /etc/php/cli-php5/ext-active
    Additional .ini files parsed:      /etc/php/cli-php5/ext-active/php_gtk2.ini,
    /etc/php/cli-php5/ext-active/xdebug.ini
    To see which php.ini is used by PHP on your web server, create a file with only as the contents, and save it in your local web root as check_php.php. Open the file in your browser as http://localhost/check_php.php, to find the path to the php.ini file your web server is using.
  3. Now check PHP's include_path setting on command line:
    $ php -c /path/to/php.ini -r 'echo get_include_path()."\n";'
    To check PHP's include_path in your web server, create a file with only as the contents, and save it in your local web root as check_php.php. Open the file in your browser as http://localhost/check_php.php, to verify the include_path your web server is using.
    In every case, PEAR's php_dir should be in the include path. If not, add it in your system's php.ini.
  4. Now that this is done, try including a file. Create a new check_pear.php file with the following contents:
    require_once 'System.php';var_dump(class_exists('System'));?>
    System.php is shipped with every PEAR installation and thus should be on your computer, too. Open the file with the browser from your web server, and also try it on command line. The only output should be
    bool(true)
    A message like:
    Warning: require_once(System.php): failed to open stream:
     No such file or directory in /path/to/check_pear.php on line 2
       
    means that your include path is not correct. (So go and fix it!)
    A completely white page in your browser hints two things:
    • Your server is configured to not display any errors to the user/browser (display_errors Off)
    • There was an error including System.php, and you should check you server's error log.
That's it! Now go on and install some packages.

Things that could be in your way

  • After changing php.ini, you need to restart your web server.
    Few people also reported they had to restart the whole machine physically, probably due to PATH changes not propagating correctly. Before wasting hours and after you tried everything else, just try that.
  • Newer Linux distributions use multiple php.ini files; mostly one for the web server (e.g. /etc/php/apache2-php5/) and one for command line (like /etc/php/cli-php5/). Make sure you edit the right ones.
  • On Windows, recent versions of PHP use php.ini from their own directory (where php.exe is). You still might have an old php.ini in your windows or system(32) directory that fools you.
  • You cannot get away with using absolute paths in your own require_once() statements as an altervative to fixing your include_path, because all the other files that are then required by your scripts are all coded for relative pathing based on include_path.

Modifying php.ini

To get PEAR working properly, you need to adjust PHP's include_path. After you found php.ini, open it in an editor.
Search for the line include_path.
Now that you found it, you probably will see a semicolon ; at the beginning. This means the line is a comment. Add a new line below it.
In this line, write:
include_path="."
Depending on your operating system, add a : (Unix/Linux/FreeBSD/Mac OS X) or a ; (Windows) after the dot. Add PEAR's php_dir after it. (The directory System.php is located in!)
The result should look like that:
; Unix
include_path=".:/usr/local/php/pear/"
or
; Windows
include_path=".;C:\php\pear\"

Thursday, January 6, 2011

How to setup proxy server settings in browsers

I already set the proxy server configuration to work with any IP so all you need to do is to set the browser to use the manual proxy configuration.

How to setup proxy server settings in Firefox on Windows
To change proxy settings:
- Select Tools and then Options.
- Click the Advanced tab.
- Open the Network tab.
- Click the Settings button in the Connections area.
- Select Manual Proxy Configuration.
- Provide the squid server IP in the HTTP Proxy field
- Set the Port to 8080
- Check "Use this proxy for all protocols"
- Click Ok
- Click Close

------------------------------------------------------------------------------------------------------------------------------------------------------------------
How to setup proxy server settings in Firefox on Linux
- Go to Edit -> Preferences -> Advanced -> Network -> Settings
- Select Manual proxy configuration
- Provide the squid server IP in the HTTP Proxy field
- Set the Port to 8080
- Check "Use this proxy for all protocols"
- Click Ok
- Click Close

------------------------------------------------------------------------------------------------------------------------------------------------------------------
How to setup proxy server settings in Google Chrome
- Click the wrench icon
- Select Preferences
- Click "Under the Hood" tab
- Click "Change proxy settings" button under Network
- Select "Manual proxy configuration"
- Set HTTP proxy field to squid server IP
- Set Port to 8080
- Click Close

------------------------------------------------------------------------------------------------------------------------------------------------------------------
How to setup proxy server settings in Opera
- Go to Menu -> Settings -> Preferences
- Click on Advanced tab
- Select Network
- Click Proxy servers button
- Set HTTP field to squid server IP
- Set Port to 8080
- Click OK

Configuring Squid to access restricted sites blocked based on IP location

If you don’t want to use Privoxy you can still set some options in yoursquid.conf, which will get you up on level 1 or 2 at ProxyJudge. Here they are:
via off
forwarded_for off

header_access From deny all
header_access Server deny all
header_access WWW-Authenticate deny all
header_access Link deny all
header_access Cache-Control deny all
header_access Proxy-Connection deny all
header_access X-Cache deny all
header_access X-Cache-Lookup deny all
header_access Via deny all
header_access Forwarded-For deny all
header_access X-Forwarded-For deny all
header_access Pragma deny all
header_access Keep-Alive deny all
These directives control some HTTP header fields, which are set by Squid or another proxy if your Squid is part of a hierarchy of proxies. The Via and Forwarded-For fields are set to indicate that this request was forwarded by a proxy. This is something we don’t want, because this would leak the information that we’re using a proxy. Due to this reason the bunch of header_access lines deny some other fields too.
After you’ve done this you should have a rating of 1 or 2: you only get a 1 if you haven’t got reverse DNS enabled for your IP. More often than not this is something you can’t control but your ISP. If you don’t want every web server to know your current IP you can setup Squid to use another proxy as parent, e.g. a proxy provided by your ISP. Be aware that this might result in a bad rating, because the parent proxy might set the mentioned HTTP header fields and obviously you can’t change that.
So far this setup is highly effective, but I still recommend enabling Privoxy.

Wednesday, January 5, 2011

How to setup squid proxy server in ubuntu (10.04 but may apply in other versions)



Installation

At a terminal prompt, enter the following command to install the Squid server:


sudo apt-get install squid squid-common

Configuration

Squid is configured by editing the directives contained within the /etc/squid/squid.conf configuration file. The following examples illustrate some of the directives which may be modified to affect the behavior of the Squid server. For more in-depth configuration of Squid, see the References section.

Prior to editing the configuration file, you should make a copy of the original file and protect it from writing so you will have the original settings as a reference, and to re-use as necessary.
Copy the /etc/squid/squid.conf file and protect it from writing with the following commands entered at a terminal prompt:


sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.original
sudo chmod a-w /etc/squid/squid.conf.original
  • Set the following in squid.conf:
    http_port 8080
    icp_port 0
    acl river_network src 112.198.99.00/32
    http_access allow river_network
    icp_access allow all
  • Be sure to set your port forwarding in router to:
    starting port: 8080
    ending port: 8080
    protocol: TCP
    ip: 192.168.0.4 (replace this with the local ip of your squid server)
  • Restart squid using:
    sudo /etc/init.d/squid restart
    or
    squid restart
  • Test Squid using Firefox brower
    Go to Edit -> Preferences -> Advanced -> Network -> Settings
    Select Manual proxy configuration
    Provide the squid server IP in the HTTP Proxy field
    Set the Port to 8080
    Check "Use this proxy for all protocols"
    Click Ok
    Click Close
  • Testing the configuration
    Open up a random website you know wouldn’t resolve e.g http://www.squid.rox/ to test the proxy is running. You should get an error like Generated Tue, 24 Aug 2010 16:55:49 GMT by squid (squid/2.7.STABLE7). Next open up a few valid websites to build up the squid cache.
  • Validating the caching is working
    Switch back to your Ubuntu Linux Squid (Squid-cache) box and open up a terminal. If you changed your cache_dir location like I did then do sudo ls -laFo /var/spool/squid/ else, substitute the path for yours.
  • Done!

Sunday, January 2, 2011

3 Ways to Install Latest Wine in Ubuntu 9.04 Jaunty Jackalope

original article from: http://tuxarena.blogspot.com/2009/06/3-ways-to-install-latest-wine-in-ubuntu.html
I. Using the Wine PPA
A PPA (Personal Package Archives) is a separate repository which ships newer packages for various applications. You can use a PPA repository for installing newer versions of Amarok, or Wine, or Banshee etc. These repositories are hosted onLaunchpad.

In order to get the latest Wine available, you can follow these easy steps:

1. Add the Wine PPA repositories to the /etc/apt/sources.list file
Open the /etc/apt/sources.list file as root with your favourite text editor (e.g. gksudo gedit /etc/apt/sources.list or sudo nano /etc/apt/sources.list) and enter your user password. Then add the following two lines to this file and save it:

deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu jaunty main

You can also use Shift+Insert here. Then make sure to save the file and update the sources lists:

sudo apt-get update

After updating, this warning may appear:

W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9A06AEF9CB8DB0 
W: You may want to run apt-get update to correct these problems

You can either ignore it, or (optionally), install the trusted key for these repositories. In order to get the key, follow the instructions from here. Notice that this is an optional step, so you can skip it or add the key later.

Then, install Wine:

sudo apt-get install wine

Press Y when it asks to install packages from untrusted sources. This should be all, the latest Wine should be now installed (at the time of writing, the version available in this PPA is 1.1.23).


II. Compile and Install Wine from Source
This method needs more time, but this way you get to compile your own version of Wine, without using any additional repositories. Here's what you have to do:

1. Install the needed dependencies and compiling tools
First, make sure you have the sources repositories enabled, that is, a line which starts with deb-src and looks like this:

deb-src http://ro.archive.ubuntu.com/ubuntu/ jaunty universe multiverse

Notice that in Jaunty these are enabled by default, so, unless you deleted this line from the /etc/apt/sources.list file, you don't have to add anything here.

Next, type the following:

sudo apt-get build-dep wine

This command will fetch all the needed development libraries for compiling Wine, including the package build-essential, which is a meta-package consisting of tools needed to compile C/C++ sources like g++.

2. Get the Wine tarball from the official website
Download the Wine source from the official website (direct link here) and uncompress it (e.g. tar -xjf wine-1.1.24.tar.bz2).

3. Compile and install Wine
Make sure the current working directory is wine-1.1.24 (or whatever version you have), and issue the following commands:

./configure
make depend && make
sudo make install

This should be all. Notice that you can also use a different path and install as normal user:

./configure --path=/home/USER/usr
make depend && make
make install

This will install Wine inside the /home/USER/usr directory (replace USER with your username). In this case, make sure /home/USER/usr/bin is added to your $PATHvariable, preferable before the other paths.


III. Using the WineHQ Ubuntu repositories
This is yet another method of getting the latest Wine on Ubuntu. It is similar with the first method, but instead of adding a PPA repository we'll add the WineHQ repositories. Follow the steps below:

1. Add the repositories to /etc/apt/sources.list
Add the following repositories to your sources.list file:

deb http://wine.budgetdedicated.com/apt jaunty main

2. Update the sources lists
To update the sources lists use:

sudo apt-get update

With your user password.

3. Install Wine
To install Wine, just type:

sudo apt-get install wine

And this should be all.