Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Warning: Illegal string offset 'lang' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 353

Warning: Illegal string offset 'keywords' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 354

Warning: Illegal string offset 'description' in /home/content/80/4113280/html/techtouch.ca/blog/wp-content/plugins/keyword-statistics/keyword-statistics.php on line 356

Admin Life Errors, Fixes, and Encounters

29Jan/106

windows 7 keyboard layout changes

If while you're working away and weird letters start to show up such as É instead of the question mark your keyboard layout just changed.

This issue if your running Windows 7 and hit left-alt shift. Easy way to fix it is to change your "Hot keys for input languages".

To do this, open up your Control Panel, select "Change keyboards or other input methods", select the Keyboards and Languages tab, then Click the "Change keyboards..." button, click the Advanced Key Settings tab, and changing the key sequence for all actions in the "Hot keys for input languages" box to "Not assigned."

You may also want to remove any keyboard languages that you do not use in the "General" tab of the same dialog window.

Filed under: Errors 6 Comments
28Jan/101

Postfix Recipient BCC Maps freebsd

Problem: email account was created on postfix but other people want to get that email also BUT don't want to check it.

Solution: Recipient BCC Maps with postfix

Start off by adding the correct lines to postfix's main.cf file

# vi /etc/postfix/main.cf

//email for John to get bcc'ed on everything support gets
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc

# vi /etc/postfix/recipient_bcc
// this line will bcc John on everything support gets.
support@domain.com john@domain.com

//since it's a hash file, we use postmap to hash it.
# /usr/local/sbin/postmap recipient_bcc

// we then restart apache.
# cd /usr/local/sbin/
# ./postfix reload
postfix/postfix-script: refreshing the Postfix mail system

That's it, now every email support gets, John will be BCC'ed on

Filed under: software-setup, Unix 1 Comment
27Jan/100

Unable to jump to row 0 on MySQL result index

I recently found this in the error logs of apache.

PHP Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 1831 in /usr/local/www/domain/script.php on line 97

Looking at line 97, this was the current code snip.

$test = 0;
$rs = mysql_query("SELECT id FROM temp_table WHERE userId = '125366' LIMIT 1");
$test = mysql_result($rs, 0,'id');

The problem with that code is, if you get no results, your still pull results. It should be

$test = 0;
$rs = mysql_query("SELECT id FROM temp_table WHERE userId = '125366' LIMIT 1");
if (mysql_num_rows($res) == 1)
$test = mysql_result($rs, 0,'id');

This way, if we have no results, $rest stays at 0 instead of the userId that we want to return.

Filed under: Errors No Comments
26Jan/100

apache and rc.d not working in freebsd

Trying to start apache from /usr/local/etc/rc.d but it doesn't seem to be starting?
# cd /usr/local/etc/rc.d/
# ./apachectl start

In FreeBSD you must have apache_enable="YES" inside your /etc/rc.conf file. If you don't, apache will not start via /usr/local/etc/rc.d

Same goes to mysql and any other software you want to start at boot time.

Filed under: commands, Errors, Unix No Comments
25Jan/100

quick way to find big files or directories

If your system is running out of space and you can't seem to pin point where the space went to then try this command.

du -h | grep [1-9][0-9][0-9]M

The command looks in the current directory for files from 100-999MB in size.

To look for files in GB use the following (0-9GB)
du -h | grep [0-9]G

For files 10-99GB use this command
du -h | grep [0-9][0-9]G

Filed under: commands, Unix No Comments
24Jan/100

PHP

Just upgraded PHP or change hosting providers and your code seems to have stopped working? Look at php.ini (usually found in /usr/local/etc/php.ini) There is a section that disables short tags for future compatibility.

If any of your code used instead of well, your code needs to be changed. Or better yet, enable short tags in php.ini, restart apache and you should be good to go.

24Jan/101

css fixed background image

One interesting thing to do with websites it to have a fixed background image. Even if the user scrolls up and down the background stays in place. This can add a nice effect if the background has a fade effect.

How is this done? Easily with CSS.
All you need to do is 4 things, add the following to your CSS file.

body {
background-image:url(/images/background.jpg);
background-attachment: fixed;
background-repeat:repeat-x;
background-position:bottom;
}

"background-image" is the image you want to use.
"background-attachment" fixes the image to the screen.
"background-repeat" this makes the image repeat via the x-axis (left to right)
"background-position:" where should the image be? in our case, the bottom of the screen.

That's it.

Filed under: Code, CSS, HTML 1 Comment
22Jan/100

adding and deleting files in subversion

### Quick SVN script for automatically adding and deleting files
### Here's a quick bash script for automatically adding and deleting files in subversion. Don't you hate having to list each one individually? Or getting all those messages that say, "the file has already been added" when you just do svn add my/directory/*. Even more of a pain if you selectively delete a bunch of files.

# svn status | grep '^?' | sed -e 's/^? /svn add "/g' -e 's/$/"/g' | sh
# svn status | grep '^!' | sed -e 's/^! /svn delete "/g' -e 's/$/"/g' | sh

###commit a single file (CheckIn)
# svn ci index_body.php -m 'New design changes'

22Jan/100

add user subversion

Need to add a user to subversion but it overwrites the existing password list of users? It happens to me, maybe there's an extra trigger I need to specify... I don't know but this works!

Add user_name with password user_password_123 to htpasswd_test
# /usr/local/apache2/bin/htpasswd -c -m -b /usr/local/ss_repo/conf/htpasswd_test user_name user_password_123
Adding password for user rsamuel

Get the username & password from the file (copy it)
# vi /usr/local/ss_repo/conf/htpasswd_test

In our case
user_name:$apr1$fMwR0...$1GUGyChlCnN4KY/2fuUuJ.

Paste it into the REAL htpasswd file
# vi /usr/local/ss_repo/conf/htpasswd

PASTE IT
user_name:$apr1$fMwR0...$1GUGyChlCnN4KY/2fuUuJ.

Save and exit

That it's, now a new user has been added into subversion

21Jan/101

memcached php mysql freebsd

Too many slow queries running on MySQL and some can not be fixed without a major change? Here's a potential solution, cache it!

Step 1) Install memcache, in this case on FreeBSD

1. cd /usr/ports/databases/memcached; make install clean
2. vi /etc/rc.conf, and add memcached_enable="YES"
3. /usr/local/etc/rc.d/memcached start
4. run "netstat -an" to check that a process is listening on TCP 11211
5. cd /usr/ports/databases/pecl-memcache ; make install clean
6. /usr/local/bin/php -i | grep -i 'memcache'
7. Play with memcached in PHP scripts

step 2)
use memcache in your scripts!

Filed under: MySQL, PHP 1 Comment