Tuesday, April 15, 2014

Autogenerate footer year with PHP

Use this php code at the footer of your website to ensure your footer PHP date is always at the current year.
You need PHP web page not static HTML. If your server handles PHP, then use the code below to insert into your website’s footer. Note this will only work with PHP web pages not static HTML.

Current Year Display

This pulls in the current date using server technology, and is really easy to implement instead of manually typing the year every year.
&copy; <?php echo date("Y"); ?> Copyright. 
displayed: © 2014 Copyright.

Website Start and Current Year

Here you set the date your website was launched, and let the PHP automatically keep the current year up to date.
&copy; <?php
$copyYear = 2008; // Set your website start date
$curYear = date('Y'); // Keeps the second year updated
echo $copyYear . (($copyYear != $curYear) ? '-' . $curYear : '');
?> Copyright. 
displayed: © 2008-2014 Copyright.

Saturday, December 14, 2013

Drupal Database Problem - Inno DB Error

Instead of your Drupal Site you are faced with this Error Message.

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1286 Unknown table engine 'InnoDB': SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 167 of /var/www/includes/lock.inc).

This can happen after restarting sql and blocking of the InnoDB.

One solution is to remove ib_logfiles from /var/lib/mysql and restart mysql.

Friday, November 29, 2013

Centos: Update Drupal via Drush

Updating your drupal instance with Drush is a fast and easy way to get the things done:

1. check if pear is installed

# pear version
PEAR Version: 1.9.4
PHP Version: 5.3.3
Zend Engine Version: 2.3.0

2. add the drush channel

# pear channel-discover pear.drush.org
Adding Channel "pear.drush.org" succeeded
Discovery of channel "pear.drush.org" succeeded

3. change to the folder where your drupal site is installed

example given:

# cd /public_html/site_xy

4. update to the new drupal version (example drupal 7.24)

# drush pm-update projects drupal-7.24

you are done

Further documentation on drush specific installation issues:


Thursday, November 7, 2013

How to remove a Raid Interface

If you are unsure about your raid volumes:
# mdadm --detail /dev/md1
or to get your different md's
# cat /proc/mdstat
To remove an existing RAID device, first deactivate it by running the following command as root:
# mdadm --stop raid_device  
Once deactivated, remove the RAID device itself: 
# mdadm --remove raid_device
Finally, zero superblocks on all devices that were associated with the particular array: 
# mdadm --zero-superblock component_device
Example Removing a RAID device
Assume the system has an active RAID device, /dev/md3, with the following layout:
# mdadm --detail /dev/md3 | tail -n 4
    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
In order to remove this device, first stop it by typing the following at a shell prompt:
# mdadm --stop /dev/md3
mdadm: stopped /dev/md3
Once stopped, you can remove the /dev/md3 device by running the following command:
# mdadm --remove /dev/md3
Finally, to remove the superblocks from all associated devices, type: 
# mdadm --zero-superblock /dev/sda1 /dev/sdb1 /dev/sdc1

Sunday, October 20, 2013

PC Sound Card Jack Colors

When the first sound cards on the PC, the jacks were typically all one color, mostly black. This state of affairs remained in effect until "PC 99," a pseudo-standard collaborated on by Microsoft and Intel (and third in a series of four "PC System Design Guide" standards which also included PC 97, PC 98, and PC 2001) defined a new industry standard for sound card jack colors. The basic jack colors go something like this:
  • Green: Audio out (front speakers)
  • Black: Audio out (rear speakers)
  • Pink: Microphone in
  • Blue: Line in
  • Yellow/Orange: Subwoofer out
On surround-sound sound cards, the difference between the green and the black jacks is that the green is for the front speakers, while the black is for the rear. On stereo sound cards with only one line-out jack, this jack may be either color, although green seems to be preferred as it more explicitly defines the jack as being an audio output. If a surround-sound sound card is configured for regular stereo (2-speaker) output, the green and black jacks are interchangeable.

The pink and blue jacks are both used as audio inputs for the sound card to record with. The difference is that the pink jack is intended for use with an unpowered microphone, while the blue jack is meant to take a line-level audio input. In audio terms, then, the sound card will generally use a much higher-gain amplifier for the microphone input, since most computer microphones make such a weak signal (typically only a few millivolts) that the recording would be virtually inaudible without significant amplification. The blue line-level input, by contrast, will use a much lower-gain amplifier - or, frequently, no amplifier at all, as it is designed to receive an already-amplified signal produced by the output of powered audio equipment, which typically produces a signal level of over 100 millivolts. At best, plugging a line-level signal into the microphone jack is likely to vastly overdrive the sound card's microphone amplifier, resulting in unusably clipped recording; at worst, doing so may burn out the sound card altogether.
Also note that since most computer microphones are mono, the pink microphone input is usually mono as well, while the blue line-in jack can typically receive stereo audio.

Additionally to these colors, some sound cards emboss (or print) symbols on their mounting bracket representing the functions of these jacks for further identification. Typically, the audio-out jacks are represented with a symbol of a wave-shape with an arrow coming out of it (symbolizing sound waves coming "out" of the card), the line-in jacks have a symbol of a wave with an arrow pointing into it, and the microphone jack usually just has a small picture of a microphone. However, the surfaces of the mounting brackets on PC sound cards are so cramped for space that there is often no room for such symbols. This is also the reason why PC sound cards have standardized on the relatively tiny 1/8" (3.5 mm) jack size while most other professional audio equipment uses 1/4" (6.35 mm) jacks or RCA jacks as a standard.

Sunday, June 30, 2013

Centos 6.4 and Google Chrome 28 update

Centos seeems not to support the new updates from Google Chrome. The Problem is libstdc++.so.6 which isn't available on centos 6.

There are some options for this issue:

Just keep running the old version until centos 7 is ready and disable update issue:

go to /etc/yum.repos.d/google-chrome.repo set enabled=0 will disable it and stop the failures.

Install Chromium Browser (with Pepper Flash plugin and Chrome PDF viewer plugin) on CentOS 6 / Red Hat (RHEL) 6.

1.Change root user 

2. Install/enable hughesjr Chromium EL 6 repository
cd /etc/yum.repos.d
wget http://people.centos.org/hughesjr/chromium/6/chromium-el6.repo

3. Install Chromium Browser on CentOS 6 / RHEL 6
yum install chromium

4. Install Pepper Flash Player on Chromium Note: this is optional step and you will need 200-250 Mb temporary disk space.
4.1 Get hughesjr Helper Script
cd /tmp wget https://raw.github.com/hughesjr/chromium_el_builder/master/chrome_pepperflash_copy.sh
4.2 Make chrome_pepperflash_copy.sh Executable
chmod +x chrome_pepperflash_copy.sh
4.3 Install Pepper Flash on Chromium
This will take a while, it downloads Google Chrome and extracts Pepper Flash plugin to /opt/chromium and modify Chromium launcher.

5. Install Google Chrome PDF Viewer Plugin on Chromium Note: this is optional step and you will need 200-250 Mb temporary disk space.
5.1 Get hughesjr Helper Script
cd /tmp
wget https://raw.github.com/hughesjr/chromium_el_builder/master/chrome_libpdf_copy.sh
5.2 Make chrome_libpdf_copy.sh Executable
chmod +x chrome_libpdf_copy.sh
5.3 Install Google Chrome PDF Viewer Plugin on Chromium ./chrome_libpdf_copy.sh  

Tuesday, January 8, 2013

You like own storage? Install Owncloud!

Install ownCloud 

This section describes in detail how to install ownCloud from the source tar balls.

Download the latest version of ownCloud from https://owncloud.com/download/. It will arrive as a tar.bz2 file.

wget http://mirrors.owncloud.org/releases/owncloud-x.x.x.tar.bz2

Change into your webspace directory, confirm that there is no directory called “owncloud” that can be overwritten, and unpack the tar file.
tar -xjf path/to/downloaded/owncloud-x.x.x.tar.bz2

It will create the ownCloud application inside the subdirectory “owncloud”. To work properly, ownCloud needs to be inside your webspace. The default locations are on

openSUSE / SLES: /srv/www/htdocs/
Fedora / RHEL: /var/www/html/
Ubuntu / Debian: /var/www
The next step is to create the directory for ownCloud to store its files in. Change into your ownCloud directory and create a directory called data.

Once ownCloud is installed, you need to change some file permissions and ownerships to allow the web server to  access and update the ownCloud configuration files and store your data. To do this, change into your ownCloud directory and change the owner of some of the files to the apache user. The correct user varies by Linux distribution family. Here are some examples:

openSUSE / SLES:
Go to /srv/www/htdocs/owncloud (if that is your ownCloud directory)
chown -R wwwrun:www config data
chown wwwrun:www apps
chmod 750 apps config
chmod -R 770 data

Fedora / RHEL:
Go to /var/www/html/ (if that if your ownCloud directory)
chown -R apache:apache config data
chown apache:apache apps
chmod 750 apps config
chmod -R 770 data

Ubuntu / Debian:
Go to /var/www (if that is your ownCloud directory)
chown -R www-data:www-data config data
chown www-data:www-data apps
chmod 750 apps config
chmod -R 770 data

Open your web browser and navigate to your ownCloud instance. If you are installing ownCloud on the same machine as you will access the install wizard from, the url will be:http://localhost/ (or http://localhost/owncloud. For basic installs SQLite is easy to setup (ownCloud will do it for you). For larger installs you should use MySQL or PostgreSQL. Click on the Advanced options to show the configuration options. You may enter admin credentials and let ownCloud create its own database user, or enter a preconfigured user. At this point your install is finished . Happy uploading.

Big Files

The upload size is maybe restricted to 2 MB: As a default, PHP is configured for only 2 MB uploads. This is not entirely useful, so it is important to increase these variables to the sizes you want to support on your server. So edit your servers php.ini file and change this to your desired values. example:

upload_max_filesize = 500 MB
post_max_size = 600 MB