Installing Peer Guardian on Ubuntu
0Some of you might be familiar with an application called PeerBlock which is made specifically for Windows. You may also remember the older version called PeerGuardian which is also made by Phoenix Labs. Whatever the reason is for needing these types of applications, I thought it might be useful for the Linux beginners to know how to install and use this application.
Step 1
First and foremost, we need to somehow download this application to be able to use it. We have two possible places we can download from:
Debian at http://moblock-deb.sourceforge.net
Ubuntu at Debian at http://moblock-deb.sourceforge.net
Ubuntu at https://launchpad.net/~jre-phoenix/+archive/ppa
For sake of simplicity, we’ll just download the files from sourceforge.
Step 2
Open Terminal (Control + Shift + I is a shortcut to opening terminal)
We need to install some additional libraries for us to actually easily package this software into something we can use.
Copy and paste the following into terminal and run each command.
1 2 | sudo apt-get install devscripts debhelper po-debconf zlib1g-dev sudo apt-get install libnetfilter-queue-dev libnfnetlink-dev libdbus-1-dev libqt4-dev |
Step 3
Extract the tarball archive so we can access the files inside of the folder:
1 | tar xvfz pgl-2.1.3.tar.gz |
Step 4
Navigate into the extracted directory:
1 | cd pgl-2.1.3 |
Now we want to compile all of the files into deb packages so we can install them. Issue the following command inside the pgl-2.1.3 folder:
1 | sudo debuild --no-lintian -us -uc -tc -b |
Look within the containing directory (for me it was Downloads) and you will see the following deb packages created for us:
- pglcmd_2.1.3-1_all.deb
- pgld_2.1.3-1_*.deb
- pgld-dbg_2.1.3-1_*.deb
- pgl-gui_2.1.3-1_*.deb
- pgl-gui-dbg_2.1.3-1_*.deb
Note: * should represent the architecture your CPU is. In my case, it’s amd64 but for you it might be i386, x86_64, or something different.
Step 5
Now we finally get to utilize those newly created deb packages and bring the application to life!
Run the following commands in terminal:
1 2 3 4 5 | sudo dpkg -i pgld_2.1.3-1_*.deb sudo dpkg -i pglcmd_2.1.3-1_all.deb sudo dpkg -i pgld-dbg_2.1.3-1_*.deb sudo dpkg -i pgl-gui_2.1.3-1_*.deb sudo dpkg -i pgl-gui-dbg_2.1.3-1_*.deb |
Note: the wildcards (*) should work just fine for installing these packages. In the event they are not then replace them with the necessary text before .deb and after 2.1.3-1_
Once all of the deb packages have been install then you have PeerGuardian on your system! Hurray! We can run peerguardian by searching for it on our desktop (click the ubuntu home button for those with the default Unity DE) or we can start the application via the following:
1 2 3 4 5 6 7 8 9 10 | # use this command for launching the GUI sudo /usr/bin/pgl-gui # use this command for the command-line application sudo /usr/bin/pglcmd start # ensure the application works correctly sudo /usr/bin/pglcmd test # we can also view stats on the applciation sudo /usr/bin/pglcmd stats # stop the application by running sudo /usr/bin/pglcmd stop |
Fixing Can’t get filling percentage magento error
1Fixing magento errors can be quite cumbersome especially when you only receive a log message and magento saying that it can’t produce any output for security reasons. One error we encountered was quite puzzling and involved an issue with memcached and the native magento caching.
“Can’t get filling percentage”
Is the error we’re going to touch base on today. The only prerequisite is that you must have memcached installed. This tutorial only covers a fix to this error when caused by memcached.
Note: it is imperative that memcached is actually running. Type:
1 | service memcached restart |
If you encounter any error, contact your webmaster or troubleshoot the issue. We don’t necessarily want to use service memcached reload here because it may or may not give us any errors.
Step 1
Verify your app/etc/local.xml file and make sure you. Here is the configuration we used and it works quite well for us:
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | <config> <global> <install> <date><![CDATA[Thu, 24 Mar 2012 08:15:24 +0000]]></date> </install> <crypt> <key><![CDATA[foobar]]></key> </crypt> <disable_local_modules>false</disable_local_modules> <resources> <db> <table_prefix><![CDATA[]]></table_prefix> </db> <default_setup> <connection> <host><![CDATA[localhost]]></host> <username><![CDATA[foo]]></username> <password><![CDATA[bar]]></password> <dbname><![CDATA[foo]]></dbname> <active>1</active> </connection> </default_setup> </resources> <session_save><![CDATA[db]]></session_save> <!-- begin cache config --> <cache> <prefix>alphanumeric</prefix> <backend><![CDATA[memcached]]></backend> <slow_backend><![CDATA[database]]></slow_backend> <memcached> <servers> <server> <host><![CDATA[127.0.0.1]]></host> <port><![CDATA[11211]]></port> <persistent><![CDATA[1]]></persistent> <weight><![CDATA[1]]></weight> <timeout><![CDATA[10]]></timeout> <retry_interval><![CDATA[10]]></retry_interval> <status><![CDATA[1]]></status> </server> </servers> <compression><![CDATA[0]]></compression> <cache_dir><![CDATA[]]></cache_dir> <hashed_directory_level><![CDATA[]]></hashed_directory_level> <hashed_directory_umask><![CDATA[]]></hashed_directory_umask> <file_name_prefix><![CDATA[]]></file_name_prefix> </memcached> </cache> <!-- end cache config --> </global> <admin> <routers> <adminhtml> <args> <frontName><![CDATA[admin]]></frontName> </args> </adminhtml> </routers> </admin> </config> |
Verifying that your config file is correct, we need to do one more thing to make sure that magento actually sees this updated config file and not your old cached copy.
With SSH
Navigate to your document root of your magento install.
1 2 | cd var/cache rm -rf * |
The above commands will completely clear out any remaining cache that magneto might be reading from. Reload your site and see if the issue persists.
With FTP/SCP
Open your favorite FTP/SCP client and navigate to the directory where magento is installed.
Open the var directory
Open the cache directory
Select all of the items and press delete.
Open var/sessions and delete all of the contents in there IF you are using your file system to store the sessions.
Via SSH:
1 2 3 4 5 6 | cd /path/to/magento/ rm -rf var/cache/* # use the following code if you are using your file system to store session data # if you are not sure then check the app/etc/local.xml file # look for <session_save><![CDATA[files]]></session_save> rm -rf var/session/* |
If you are using your database to store sessions, be sure you clear these too otherwise the error can persist!
Open phpmyadmin and truncate the core_session table or do it via command-line (see below):
1 2 | mysql -p -u username database mysql> TRUNCATE TABLE core_session; |
Step 2
Seeing the same error or even a different error? Fear not! We still have some tricks up our sleeves.
Assuming the pecl extension is correctly configured then type the following WHILE logged onto your server via ssh. We must be on the server for this to work.
1 2 | telnet 127.0.0.1 11211 flush_all |
You will see the following output:
1 2 3 4 5 6 | telnet localhost 11211 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. flush_all OK |
You have successfully cleared the cache. Try reloading your page now and it should resolve this error.
If this does NOT resolve your error, post comments on this post and any solutions you have found!
Adding Oracle JRE and JDK to Ubuntu
0Problem: Need to install Oracle JRE and JDK and NOT Open JDK/JRE on Debian-style distros.
Solution:
After thumbing through countless pages I finally found the answer!
1 2 3 | sudo add-apt-repository ppa:ferramroberto/java sudo apt-get update sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts |
The code above will add java to your repository (found in /etc/apt/sources.list.d/) and store it on your file system.
We need to update aptitude so it recognizes the new repository location, so we issue the sudo apt-get update command
Finally, we need to actually install the desired software. Since ubuntu officially doesn’t have the repository automatically listed we needed to add a new location. When we issue the apt-get install packagename command aptitude will query the list of known repository locations that come pre-bundled with Ubuntu or any Debian-style distro (Ubuntu included).
For those that are really interested, we can quickly cat the .list file and we will see the following:
1 2 | deb http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric main deb-src http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric main |
The addition of the new repository location creates the file in the /etc/apt/sources.list.d/ as mentioned previously.
Upgrading Magento 1.5.0.1 to 1.6.2.0
2Upgrading Magento is always scary – kind of like flashing your BIOS on a PC. It is always important to backup your entire file system and magento database prior to upgrading to the most recent version to avoid catastrophic results.
This tutorial is for those of you who are at whits end and you just want to curl up and die in a hole because you attempted to upgrade magento and you encountered errors like:
1 | Error in file: "app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php" - Column "base_shipping_hidden_tax_amount" does not exists on table "sales_flat_creditmemo" |
1 | Error in file: "/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php" - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-918' for key 'UNQ_BY_CUSTOMER' |
Not only are these errors annoying but magento has a very unhelpful error system that often gives cryptic errors or it stores them in random files in the /var/reports directory.
Before you begin any of this, be sure to back up your entire file system.
Fixing Integrity constraint violation: 1062 Duplicate entry ’0-918′ for key ‘UNQ_BY_CUSTOMER’
This fix actually isn’t too bad as you might think. Even if you have no coding experience or experience connecting to your server via FTP, this will be easy.
If you are not familiar with connecting to a server via FTP, we have a lovely tutorial explaining how to do this. If you are familiar then please continue reading!
Navigate to the root of your magento installation and find the app directory. Once there, enter the app directory and then enter the etc directory. You will see a few files (see image).

Open the config.xml file in your favorite text editor (we recommend using notepad++ for ease of use for those of you who do not have an IDE). Around line 41 you will see the following:
1 | <initStatements>SET NAMES utf8</initStatements> |
Comment out this line like the following:
1 | <!-- <initStatements>SET NAMES utf8</initStatements> --> |
And then add this line below the commented out code
1 | <initstatements>SET NAMES utf8; SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0;</initstatements> |
Now that this issue is resolved, try to load your magento site again. Your site is working again! But there may be a greater issue here so keep reading…
Fixing Column “base_shipping_hidden_tax_amount” does not exists on table “sales_flat_creditmemo” or other MySQL Related Errors
If you have the error above or you have other general MySQL errors in magento then there still is hope.
Step 1
Navigate to the /var/cache directory of your magento installation and delete all of the cache.
Navigate to the /var/sessions directory of your magento installation and delete all of the sessions.
Step 2
Go to this the magento website or download the magento database repair tool directly. Unzip this file and you will see a php file.
Place the php file in the root directory of your magento installation and continue to the next step.
Step 3
Install a fresh copy of Magento CE 1.6.2.0 or you can simply download this sample database for reference if you would like to avoid having to install a fresh copy of magento.
Import the fresh database via phpMyAdmin (or by using your favorite database managment tool) and wait until it is fully completed with NO errors! Remote databases are OK.
Note: if you are accessing your database via ssh then see here:
To export an entire database:
1 | mysqldump -u username -p database_name > database_name.sql |
To import an entire database:
1 | mysql -u username -p database_name < database_name.sql |
Step 4
Now that you have a copy of the database you can upgrade with and that we can reference, it is time to finally repair this database and get it working! We need to download the Magento Database Repair Tool.
Step 5
Extract the file anywhere within your file system (the document root directory will suffice) and then type in your web browser: http://yourdomain.com/magento-db-repair-tool-1.0.php and you will see this page:

Note: this script doesn’t care where the databases are located. You can connect to a remote database or a database that is on your localhost. Just ensure you enable access to your database remotely via your hosting control panel.
Type in the required information (be sure to include any and all prefixes you have) and then click continue. This script will match the corrupted database to the good database and repair any incorrect SQL table structures and repair any important data in those tables. Things like usernames, password, products will NOT be affected so do not worry!
When this process is complete you will see the following:

Final Step
Try entering in the URL of your magento installation to ensure everything worked correctly. If it did not then restore your file system and database and make sure you went through the motions correctly. Be sure to document and research any errors on the magento forums and see if anyone else has encountered/solved these errors!
But remember that line of code we replaced?
1 | <initStatements>SET NAMES utf8</initStatements> |
Be sure to replace our edited line of XML with the original as this is a security risk!
Hope this helps all those out there that are struggling with this!
Setting up Magento in XAMPP
0Some of you may be banging your head against a wall trying to figure out how to setup Magento in your local XAMPP installation. Fret not aggravated peoples, we have found the answer!
As you may know, Magento is a popular e-commerce platform that can handle anything from small business to enterprise e-commerce solutions. Despite it’s rather large size and not-very-optimized code, the community edition of Magento is notorious for having excessively large databases and a single .log file that is around 3GB after awhile (which is what we encountered)…
However, if you are installing a FRESH COMMUNITY EDITION (version 1.6.2.0 at the time of this tutorial’s birth), then we will go through the steps with you one by one!
The Process
Herein lies the process for installing magento:
Step One
Download the most recent community edition of magento!
Step Two
Go to http://localhost/phpmyadmin/ and add a new database!

Step Three
Extract the magento files in C:\xampp\htdocs\magento\ for Windows
OR
/Applications/XAMPP/htdocs/ on Mac
Note: the above directories are the default directories and may not necessarily be the places where you installed xampp. If this is different, then extract your magento files into the ApacheDoc document root “htdocs” folder of your xampp installation.
Step Four
Next we should update our hosts and get it out of the way now. Bear in mind, the hosts file maps domain names to ip addresses. When you type a domain into your browser window, your browser will check to see if there is a matching entry for that domain name in your host file.
On Windows navigate to C:\windows\system32\drivers\etc right click on your hosts file and select edit. You will see a bunch of random numbers which are ip addresses.
Add:
1 | 127.0.0.1 magento.localhost.com |
and save the file.
Press the window key + r (or simply search for and/or open cmd.exe) and type the following:
1 | ipconfig /flushdns |
Editing the Hosts File on Mac
Open Terminal and type the following (after each command press return):
We need to open the hosts file for editing
1 | $ sudo nano /private/etc/hosts |
Add this to the bottom of the hosts file
1 | 127.0.0.1 magento.localhost.com |
When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.
Now we must flush the DNS cache on our system!
1 | $ dscacheutil -flushcache |
Step Five
Assuming all went well, you are now ready to open your favorite web browser and type in magento.localhost.com/magento/ and you will be redirected to the magento installation screen!
Some options to you should choose when configuring your database information:
- Skip URL Validation
- Use Apache Server Rewrites
As you process through the installation process, please be patient. Do NOT click multiple times on any field especially the page where you enter in database information. Magento has a very extensive database and therefore it takes time to install and add all of the tables and populate those tables with relevant information.
Step Six
That’s it! You should have a fully functioning Magento application on your XAMPP installation!




