How to fix iTunes not recognizing iPhone or iPad on Windows 8 or Windows 7

I recently ran into this problem of iTunes NOT seeing my iPhone or iPad, even though Windows 8 recognized it with no problem.

Well, come to find out, somehow the "Apple Mobile Device USB Driver" drivers got uninstalled and only Microsoft Windows 8 drivers "Portable Devices" MTP USB Device driver existed.

Notepad++ : How to enable syntax highlighting for PHP, HTML, CSS, etc

I found an interesting discovery with Notepad++ where PHP, HTML, CSS, etc language syntax highlighting didn't appear in the language menu. Not sure if this is the result of the way an older version set the settings--whereas, even if you upgraded to latest version (without uninstalling first), the upgrades wouldn't overwrite the original settings file. I think this was disabled at the time of install when it asks if you want it to be your default for HTML files; where I normally UNselect this, since I use a PHP IDE to handle PHP, HTML, CSS, etc files.

Anyway... The fix:

Tags: notepad++ APPS HTML CSS PHP

How to get 3TB HDD to work with NVIDIA nForce motherboards

If you recently tried installing a 3TB Hard Drive on an NVIDIA nForce motherboard you'll notice that only about 1/3 of the drive is recognized by Windows. The fix is quite simple:

1. Download NVIDIA nForce Drivers 15.58 (64bit) , Download NVIDIA nForce Drivers 15.58 (32bit) or later

2. Install the NVIDIA NFORCE 15.58 drivers and reboot your system after the install is done.

3. You're done. Your PC should be able to see the entire 3TB drive (it should be around 2.72TB)

Tags: admin windows HDD

Enable Zend OPcache for PHP 5.5 or Install ZendOpcache for PHP 5.3 or PHP 5.4

Zend Opcache is part of PHP 5.5, however, it's not enabled by default. It's a successor to APC cache--meaning APC cache is never going to be compatible with PHP 5.5 or higher

Opcache is also around 10% faster than APC, and more stable.

However, if you're on PHP 5.3 or PHP 5.4, you can still use ZendOpCache, and it should still be a bit faster than APC

Enable OpCache (part of with PHP 5.5)

vi /usr/local/lib/php.ini

Paste this under your extension_dir

Tags: Linux cache APC opcache

Disable IE "compatibility mode" through .htaccess

Internet Explorer "compatibility mode" is that dreadful page icon, inconveniently placed right next to the refresh button/icon.

What it does is turn IE 8 or higher into an outdated browser, so it can properly display really old school websites that were, likely, built using invalid and/or outdated HTML code. It's a horrible feature, that I see no practical use for whatsoever. Plus it's easy to accidentally click it, because it's located a few pixels away from the refresh button--talk about non-intuitive...

Anyhow... 

This is how you disable IE compatability mode on your website.

  In your .htaccess insert the following:

Header set X-UA-Compatible "IE=9; IE=8; IE=7;IE=edge"

Woooo! We're done. That dumb IE compatibility mode icon won't show ever again.

 

Tags: Server apache IE Web Development

How to install spamassassin with directadmin custombuild

Let's assume CustomBuild is installed

We have to configure our options.conf and enable the spamassassin installation.

cd /usr/local/directadmin/custombuild
vi options.conf

Now we enable it under #mail options and save:

#Mail options
exim=yes
eximconf=no
clamav=no
spamassassin=yes
dovecot=yes
pigeonhole=no

Next we run update custombuild

./build update

BUT before we run ./build spamassassin we must first download all the requirements (as custombuild will not do this for us):

yum install spamassassin -y; yum -y erase spamassassin

So now that yum downloaded all the requirements we can now do the install. Though let's also update exim before we do this:

Upgrade Drupal 6 to Drupal 7 using Drush site-upgrade

Ok... So you decided that it's time to upgrade from Drupal 6 to Drupal 7. It's not going to be easy, but using Drush will make life a little easier.

What this will do is save you the time of manually upgrading Drupal 6 core and drupal 6 modules to Drupal 7 core and drupal 7 modules. Of course likely your site will be broken after the drush site-upgrade, but at least you have the manual job of searching for upgraded modules taken care of.

So, let's begin...

Install latest version of Drush


cd /usr/local/share
# install GIT if not available
yum install git
git clone https://github.com/drush-ops/drush.git drush
ln -s /usr/local/share/drush/drush /usr/local/bin/drush
drush

Tags: Drupal drush

New Server Checklist for DirectAdmin (2013 edition)

Setup DirectAdmin with an SSL certificate

source: http://help.directadmin.com/item.php?id=15

If you don't own a certificate, you can create your own:

/usr/bin/openssl req -x509 -newkey rsa:2048 -keyout /usr/local/directadmin/conf/cakey.pem -out /usr/local/directadmin/conf/cacert.pem -days 9000 -nodes
chown diradmin:diradmin /usr/local/directadmin/conf/cakey.pem
chmod 400 /usr/local/directadmin/conf/cakey.pem

Or... If you already have your own certificate and key, then copy/paste them in the following

Certificate:

vi /usr/local/directadmin/conf/cacert.pem

Key:

vi /usr/local/directadmin/conf/cakey.pem

Once done one of the above, edit your directadmin.conf

wget download all files from a directory with resume

Here is how you download all files from a directory using wget with automatic resume of partially downloaded files (in case your connection gets cut off)

wget -r -c --no-parent http://www.whateveraddress.com/downloads

Keep in mind this will only download files that it can read from that location.  If you need to wget a bunch of files from a directory you have SSH or FTP access to you first have to do the following inside that directory:

vi .htaccess

and paste in the following and save.

Options +Indexes

Now that directory should show all the files in it via a browser.

Tags: Linux admin

How to install XCache 3.0 from source

Alright... So APC has been pretty unstable for me on 2 separate servers running PHP 5.3.x and PHP 5.4.x. So I figured I'd give XCache a try after reading about similar problems with APC.

Anyhow...

Here's how to install XCache 3.X from source on CentOS

Get the latest version of XCache from here: http://xcache.lighttpd.net/#Downloads

Latest version at the time of this writing is XCache 3.0.1


cd /usr/local/src
wget http://xcache.lighttpd.net/pub/Releases/3.0.3/xcache-3.0.3.tar.gz
tar xvfz xcache-3.0.3.tar.gz
cd xcache-3.0.3
phpize
./configure --enable-xcache
make
make install

Note the installation path. Example here are my paths:

Tags: XCache APC Linux Server how-to

How to create a larger /tmp location using ext2 filesystem

Increasing the size of /tmp is not a practical thing to do on a busy server, mainly because you probably won't be able to dismount /tmp because it's constantly used by various services--trying to find and kill them all is too tedius. (Plus you won't be able to do single user mode through SSH)

So what we will do here is create a whole new /tmp storage location, make a backup of the old /tmp, add the new location to fstab, reboot the server, copy everything from the backup /tmpBKP location to new location, and lastly reboot the server again.

Tags: Linux linux server admin

Add "You Save" amount and percentage to Special Price in Magento

In order to display a "You Save" for "Special Price" products in magento--to make it look similar to amazon's price display--you can do the following:

Copy

app/design/frontend/base/default/template/catalog/product/price.phtml

to

app/design/frontend/default/YOURTEMPLATE/template/catalog/product/price.phtml

Then in price.phtml that you just copied, right above:


Insert:



$_savePercent = 100 - round(($_finalPrice / $_price) * 100);
$_saveAmount = number_format(($_price - $_finalPrice), 2);
?>
Tags: magento price display

MySQL dump all databases via mysqldump -- the proper way

Here's a command that properly dumps all databases, in case you wanted to restore a full backup.

For whatever reason, many sites are using improper characters ( ' –– ' , ' – ' ) to display this mysqldump command line--copy pasting will throw up an error stating something like:


mysqldump: Got error: 1049: Unknown database '??extended-insert' when selecting the database

Here is a sample of wrong characters, which appear just fine, but won't work:


mysqldump ––extended-insert ––all-databases ––add-drop-database ––disable-keys ––flush-privileges ––quick ––routines ––triggers > all-databases.sql

or


mysqldump –extended-insert –all-databases –add-drop-database –disable-keys –flush-privileges –quick –routines –triggers > /root/all-databases.sql

Tags: mysql linux server admin

How to optimize and auto repair all MySQL databases using SSH

Here's a simple command to optimize and auto repair all tables in your MySQL database.


mysqlcheck -uroot -p --auto-repair --optimize --all-databases

This is the same thing as using PHPMyAdmin, however, you don't need to do this one by one for each database, select all tables, and optimize--and not to mention if you wanted to repair a database prior to optimizing, it will take 2x as long.

Tags: mysql Server Linux database

How to move MySQL database -- the simple way

There are plenty of articles about how to move mysql to another directory or partition by telling you to mess with the my.cnf by changing all the references of datadir and socket to the new location.

Example:


[mysqld]
datadir=/new/location
socket=/new/location/mysql.sock

Don't do this... Not only will it waste your time, but likely won't work for half the server setups. Reason being there are other factors at play when you're changing things, it's not only the my.cnf that you have to worry about. For example, if you're using Ubuntu, you may be using AppArmor and you'll also have to specify the new directory in /etc/apparmor.d/usr.sbin.mysqld

Tags: mysql Server Linux database

How to set date and time automatically in CentOS

tzselect

Answer the 3 locations questions. Then create a symlink to your local time.

rm -rf /etc/localtime
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

The symlink will be according to your time zone--above is just an example.

Now, we check the date and time

date

Time and date should now be properly set.

Tags: Linux date time

How to install APC on CentOS and DirectAdmin


cd /usr/local/src
mount -o remount,exec,suid /tmp
yum install autoconf
yum install php-pear
yum install php-devel
yum install httpd-devel
yum install pcre-devel
wget http://pecl.php.net/get/APC
tar xvfz APC-VERSION.tgz
cd APC-VERSION
phpize
whereis php-config

This will give you the location of php-config, which you will put after --with-php-config=

Tags: Server PHP APC

Drupal .htaccess rewrite with 'www' but not for sub-domains

Say you have your Drupal's .htaccess set "To redirect all users to access the site WITH the 'www.' prefix", and you added a sub-domain, and it came out looking something like http://www.sub.domain.com. So, most people will NOT want the "www" added to the url in this case. So what do you do? Easy.

Use this instead:


# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^(subdomain1|subdomain2|subdomain3)\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So what changed? We simply added this line:

Tags: Drupal Linux admin

How to set a custom sub-domain path in DirectAdmin

UPDATE: See below, there's an easier way to do this. Plus DirectAdmin's way doesn't seem to be working through the 'Custom HTTPD Configurations' way.... So, just use the way listed below. It's much easier.

*** OLD WAY / start ***
I work with Drupal's Domain Access module a lot. However, if you're using DirectAdmin as your hosting control panel, then making sub-domains will not work with the default setup. DirectAdmin puts the sub-domain into a separate directory, and in order for Domain Access to work with sub-domains on DirectAdmin, this needs to be set as the same directory/path as the top domain.

A simple work around is to login to DirectAdmin as administrator, and go into "Custom HTTPD Configurations".

Here you will paste the following code:

Tags: DirectAdmin Linux Drupal Domain Access

Flush MySQL log-bin data and disable binary log files

If your disk is starting to run out of space due to an excess of mysql-bin.XXXXXXXX files here's what to do to fix that.


vi /etc/my.cnf

under 'log-bin=mysql-bin' (the destination could be different in your my.cnf) put:


expire_logs_days = 10

Change 10 to whatever you're comfortable with.

or you can simply disable the binary log files by uncommenting the line:


# log-bin=mysql-bin

You'll also want to remove all the excessive binary log files like so:


mysql -u root -p -e "PURGE BINARY LOGS BEFORE '2012-02-15 09:00:00';"

TROUBLESHOOTING

In case you can't shutdown mysqld do the following:


pidof mysqld
kill -9 NUMBEROFPROCESS

Tags: Server how-to mysql

How to disable PHP 5.3 Deprecated errors

If you installed PHP 5.3, then you may have noticed many deprecated errors from older web apps and even current ones--like some drupal modules.

NOTICE: this is not a true fix, you could be ignoring critical errors by doing the following... but most likely you should be fine... though make sure you do not log errors, or your log files will quickly grow to an unmanageable size.

anyhow...

via php.ini :

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
; change this to Off if you still get errors.
display_errors = On
log_errors = Off

after your done... as always, restart apache...

service httpd restart

also, some sites may be using their own .htaccess or error_reporting... therefore you may need to go to affected ones and modify the .htaccess file and insert the following to disable PHP 5.3 ... I had to do this for really old web apps.

php_flag display_errors off
php_flag log_errors off

Tags: php drupal

How to install Apache Solr 3.x for Drupal 7 or Drupal 6

First we'll need to install Java 1.6 JDK, and be on PHP 5.2 or higher (You can check my PHP installation tutorial here. Also I'm on CentOS.

Install Java 1.6 JDK


yum install java-1.6*

Install Apache Solr

We're going to install Apache Solr into /usr/local/share; however you can install it somewhere else if you'd like (e.g. install it in the root dir / )


cd /usr/local/share

Download Apache Solr. We're going to use the latest version at the time of this writing: Apache Solr 3.5. Look for the latest version here: http://www.apache.org/dyn/closer.cgi/lucene/solr/

Tags: Server Drupal linux server apache solr solr

Magento Featured Products Listing on Home Page

There are a few articles and extensions I've come across showing how to add "Featured Products" on the home page of Magento. The problem is that none that I have read, seem to fully tackle the issue of being compatible with Magento 1.4.x (Magento 1.4.0.1 at the time of this writing) AND fully using Magento's features while being fairly easy to implement (i.e. without adding complicated, unnecessary,redundant or outdated code)

Tags: magento featured products

phpMyAdmin database export "Save as file" template

Whenever you do a database backup using phpMyAdmin, you are presented with a default file name structure for saves, usually like so:

__DB__

which basically gives you the name of the database you just backed up. Which is ok, however, most people would also like the date and time stamp included as well...

So...

This is how it's done... replace the above with :

__DB__-%F-%T

or for newer version of phpMyAdmin

@DATABASE@-%F-%T

__DB__ = name of database Example: my_database
%F = Same as "%Y-%m-%d" (year-month-day) Example: 2009-11-25
%T = time stamp . (24 hour format, hour_minute_second) Example: 11_07_31

which will save a file with the naming structure similar to:

my_database-2009-11-25-11_07_31.sql

You can easily use other date/time structure, to suit your personal preference.

Tags: Linux admin mysql

Magento Google Shopping Setup aka Google Base aka Google Content aka Google Merchant

Here's a quick (and hopefully easy) tutorial on how to properly setup Magento with Google Base aka "Google Shopping" or "Google Content" .

I know there is very limited help for Google Base/Shopping for Magento Community Edition 1.6 and 1.7 (and nothing official exists on any lower versions)...

The interested fact is, Magento is knowingly supplying a broken extension with 1.6 and 1.7--i.e. there is no way it will work unless you hack the core code; as we will below.

Hopefully, the community edition will get a working extension soon, just like the Magento Go version.

Anyhow... on to self help!

Tags: magento google

Flush or Clear out Exim mail queue

Exim mail queue can get out of control. If your var is on a separate smaller sized partition it can quickly run out of space.

We can see what's using up all that space via:


cd /var
du -sh * | sort -n

and as with Exim, our culprit location should be:


/var/spool/exim/input

So to quickly clear out the exim mail queue we do the following:


cd /var/spool/exim/;rm -rf input msglog;/scripts/eximup --force

And that should do it.

Magento Google Analytics goals setup

Ok... let's get right into it...

We'll assume you already have google analytics setup and working with magento...

So... we want to add Google Analytics Goals so we can track what people are doing at the different steps of checkout.

Alright... here we go...

  1. Log into your Google Analytics account
  2. Click "Admin" at the top right (of the new version of Google Analytics)
  3. Click the name of your domain
  4. Click "Goals" tab--towards the middle of page
  5. Click one of the non used "+ Goal" links
  6. Now we fill in all the info...

Tags: magento google analytics