Categorized under: Hardware, OS, Quick Tips, Ubuntu, bluetooth, dell, linux

Ubuntu Hardy Heron sound broken

Recently I was having a consistent problem with the sound on my Dell Inspiron 1720, which is running on Ubuntu Hardy Heron. It would consistently stop working all together, and I had a terrible time finding the cause of the problem. If I viewed a flash video on the web, the sound would die afterwards. If I listened to streaming Internet radio, the sound would die. If I received an emial or IM the sound would die.

Finally it dawned on me, and I am not sure why or how. But a few weeks prior I had been toying with a Bluetooth stereo headset and had turned on the Audio service in the Bluetooth manager on the services tab.

Problem fixed: I simply turned off the Audio service in the Bluetooth manager, and all is working normally again. However, if I ever need the Audio service I suppose it will break my sound.

Categorized under: Quick Tips, email, html, javascript, programming

Hiding an email address using Javascript

Have you ever wondered why you suddenly started getting tons of spam?

Do you have, or did you recently post your email address on a website?

Then the reason is probably because you did not properly protect the email address, and spammers get most email addresses from robot script that harvest email addresses from websites. It is pretty simple really. The robot script hits the largest search engines for certain key words or phrases, to help the spammer hit the most relevent email addresses, and then systematically follows the links to websites. Once the robot gets to the website it then searches all links on the page. Each link it finds on the page that is a “mailto:” is an email address, and in a matter of minutes a robot script can harvest hundreds of emails.

So now you are asking, “What can be done to protect me from these vile robots?”. Well that answer is also simple. Most robot script are not smart enough, yet, to search Javascript code that scrambles an email address and form it back into a valid email address. So here is how to do it:

First, you need to go into the HTML code and insert the Javascript as follows:

var theuser = "username"; // change this to be the username, or portion of the email to the left of the @
var thehost = "your-domain.com"; // change this to be your domain name
 
var themessage = theuser + "@" + thehost;
 
// Now we tell Javascript to bring the pieces of the email address together visually on the screen as a link
document.write("<a href=" + "mail" + "to:" + theuser + "@" + thehost + ">" + themessage + "</a>")

Note: Be sure to substitute username and your-domain.com with your own information.

Now when you view your webpage in your favorite browser (Firefox) you will see the email as a link like you wanted, and the robots will see a bunch of code that most of them cannot form into a valid email address.

Categorized under: OS, Quick Tips, apache, linux, programming, servers

Using the UNIX tail -f command to watch log files

When troubleshooting a problem in Apache it is a pain to open the log file, find an error, close the log file, and then open it again after you perform some action. This is why ‘tail’ is so handy.

Simply use the command below to view the last 100 lines of a log file, and as new entries are added to the file they are automatically displayed on the screen.

tail -f /the/file/name -n -100
Categorized under: Plesk

Plesk backup problem

I had a problem backing up domains on a server and received the following error message:

Error: Unable to create backup session: Specified file is not accessible

Finally i solved this problem!!!! it was all about wrong permission in some folders!

check that the folders ‘/var/lib/psa/dumps’ and ‘/var/lib/psa/dumps/tmp’ are chmod to 777

Categorized under: OS, Quick Tips, linux

Change/update time on Linux

Sets whether the hardware clock is stored as UTC or local time.

/etc/sysconfig/clock

Symlink /etc/localtime to /usr/share/zoneinfo/… to set your timezone.

To set the current system date/time.

date MMDDhhmm

To set the hardware clock.

/sbin/hwclock --systohc
Categorized under: Quick Tips, apache, css, javascript, programming

Javascript disable right click and image tool bar

A recent request from a client was to make life more difficult for his competitors to steal images from his site. He was worried that they could save the images using the Image Toolbar in newer versions of Internet Explorer, and by using the right click menu on the page. For those of you that wish to stop the right clickers from stealing your code, or from stealing images, here is a quick and easy way to make life more difficult for them.

To disable the Internet Explorer Image Toolbar for an entire page add this meta tag:

<meta http-equiv="imagetoolbar" content="no">

To disable the Internet Explorer Image Toolbar for an individual Image do this:

<img src="image.gif" width="250" height="250" galleryimg="no>

Now to handle those who love their “right-click”. For the entire page:

<body oncontextmenu="return false">

And for individual images:

<img src="image.gif" width="250" height="250" oncontextmenu="return false">
Categorized under: Hardware, OS, Quick Tips, Ubuntu

Headphone problem with Ubuntu 7.04 (Feisty Fawn)

I was having a sporadic problem with my headphone jack in my new Dell E1505 laptop that came pre-loaded with Ubuntu 7.04 (Feisty Fawn), using ALSA. The problem was that when I plugged in my headphones, sometimes they worked, and other times nothing happened. No sound from my headphones at all.

Here is how I fixed the sound in my Dell laptop…

Apache redirecting to home directory using userdir module

Development is made easier by running a full development environment on your workstation. I personally run a full LAMP (Linux, Apache, MySQL, PHP) environment that allows me to test what I am developing on my workstation. In this case I am on my new Dell Inspiron E1505n running Ubuntu 7.04 Feisty Fawn.

One of the problems with doing this is the need to play with permissions on ever site in the server root. So instead I am using ‘userdir’ to keep the sites for easy development and testing. In other words I use apache to pull the site from my home directory for display in my browser. Here is how I did it.

Categorized under: Hardware, OS, Quick Tips, Ubuntu, linux

Laptop not recovering from suspend mode (Dell with Ubuntu 7.04 Feisty Fawn)

I am pretty mobile, and find it a pain to boot up my laptop every time I need it. So instead I simply close it to put it into suspend mode, and simply open it and log in without the needed wait for booting up. (Even though Ubuntu loads very quickly.)

The problem is that sometimes the laptop does not recover, and I am faced with a black screen instead of my login screen. This forces me to force shutdown by hitting the power button, or forcing reboot by hitting Ctrl+Alt+Delete.

After some searching I found a remedy that seems to have fixed the problem. I simply added ‘noapic nolapic’ to my boot. Here is how I did it:

$ sudo vi /boot/grub/menu.lst

Then I found the “kernel” line that corresponds with my boot process, and appended ‘noapic nolapic’ to the end of it. Here is how that line looked when I was finished:

kernel          /vmlinuz-2.6.20-16-generic noapic nolapic

Your line may differ slightly, but simply appending to the end will work fine.

Categorized under: Plesk, Quick Tips, servers

Restarting Plesk base services

I recently had the need to restart Plesk on a server. Everything on the server was running just fine, but Plesk was not responding.

After some searching I found these handy lines that allowed me to get Plesk back up and running.

# /etc/rc.d/init.d/psa stopall
# /etc/rc.d/init.d/psa start

Note: Must be run as root, or su.

Categorized under: Hardware, OS, Ubuntu, dell, linux

New Dell Inspiron with Preloaded Ubuntu 7.04 (Feisty Fawn)

Well, after a couple of weeks waiting my shiny new Dell Inspiron E1505 preloaded with Ubuntu 7.04 (Feisty Fawn) has finally arrived. First I must say that it took a LONG time. It is pretty common for Dell to take some time getting PC’s and/or Servers delivered after it is ordered. (IBM and others tend to get them out faster.) Second, after a few days with the new laptop, it was worth the wait.

Categorized under: OS, Ubuntu, bluetooth, linux, servers

Microsoft Bluetooth keyboard and mouse on Ubuntu 7 (Feisty Fawn)

I have a Microsoft Optical Desktop Elite Keyboard and Mouse for Bluetooth, and wanted to get them working on my newly installed Ubuntu 7.04 Feisty Fawn desktop. (This was my choice after the adventure of Windows Vista deciding it was not Genuine 1 1/2 months after install, even though it was.) See this article for the details.

I found the basics of this article on the Ubuntu forums, but found that I needed to adapt it a bit. So here is that article, with my changes/additions.

Categorized under: OS, Uncategorized, windows

Goodbye Windows Vista

Well, I installed Windows Vista 1 1/2 months ago. During that time I dealt with many driver problems, software issues, and quirks. But the end has come. Today Windows Vista decided it was not Genuine, and that I needed to activate it. Of course it is Genuine, and it had already been activated, so I put in a quick (HAH!) call to Microsoft to activate it after the automated method of doing it over the web failed.

Categorized under: OS, Quick Tips, linux, servers

Redhat Linux uptime command

The uptime command is very handy to get a snapshot of info about the servers time since last reboot, and load.

Command:

$ uptime

Sample Results:

20:43:04 up 40 days, 13:43,  6 users,  load average: 2.03, 1.68, 1.5
    Breakdown of results:

  • The current time (20:43:04)
  • How long the system has been running in days and hours (up 40 days 13:43)
  • How many users are currently logged on (6 users)
  • The system load averages for the past 1, 5, and 15 minutes (2.03, 1.68, 1.5)

This is the same information contained in the header line displayed by w and top command:

$ w
$ top

Note that w displays who is logged on and what they are doing.
The top command provides a dynamic real-time view of a running Linux/UNIX/BSD system.

MySqlDump export and MySQL import

To export data as a backup you can’t beat mysqldump.

# mysqldump -u username database > database_2007-05-14.sql

Then to restore a database you would use:

# mysql -u username -p database < database_2007-05-14.sql

It doesn’t get any easier than that!

Categorized under: OS, Quick Tips, linux

Having Microsoft Fonts on Linux (Ubuntu)

I have been using Ubuntu in the office lately. However, I did not have the standard fonts that you would find on a Windows system for use in documents. So I simply used the following method to add them:

# sudo aptitude install msttcorefonts

For these fonts to display in 96dpi you may also need to add a line in your /etc/X11/xorg.conf:

# sudo vi /etc/X11/xorg.conf

Add this line in the Section “Device” somewhere before EndSection

Option     "DPI" "96x96"

Then you will need to either restart X or reboot to apply the settings. After the restart/reboot you can use the following command to see if you are using 96dpi.

# xdpyinfo | grep resolution
Categorized under: Databases, MySQL, Quick Tips

Cleaning duplicate records in MySQL easily

I was recently looking for a way to clean out a table of all records that had duplicate email addresses. To do this I used a SELECT inside an INSERT statement.

INSERT INTO subscribers(email) SELECT DISTINCT(email) FROM  bad_temp
Categorized under: OS, windows

Upgrade to Windows XP 64 bit and new system

Well, I finally did it. I decided it was time to upgrade my P4 1.2 Ghz to a shiny new Athlon 64 Dual Core 3.2 Ghz. This was brought on because of a couple of problems. First I only had 1GB of RAM in my old system, and on certain occasions I found myself running out of memory when editing images. Also, I was becoming tired of waiting on my IDE drives to give me what I asked for. Plus, my install of Windows XP Pro was almost 2 years old and was in need of cleaning.

Categorized under: linux, servers, subversion, version control

Subversion force comments to be entered

wanted to force someone to put in comments when they did a commit. So, below you will find what I did to enforce that. (I am sure that there is a more graceful way to do it, but this is how I did it.

With a default install of Fedora Core 4, Apache 2, and Subversion you can follow my example and everything should work fine.

Categorized under: networking

Cat 5 Cable twisted wire colors

Well, I had the pleasure/frustration of recently creating some patch cables. The problem was that I did not know what order the internal twisted pairs should be in. But here is the lesson I learned, and how to properly create a patch cable.

Categorized under: linux, servers, subversion, version control

Make Subversion send an email upon post-commit

ore than a week ago I wrote about getting Subversion running remotely. However, now that I have multiple people using it remotely I want to know when someone commits changes. I have come to find out that this is very simple to do using hooks. However, I did run into a little trouble configuring it. So here are my findings.

With a default install of Fedora Core 4, Apache 2, and Subversion you can follow my example and everything should work fine.

Categorized under: darwin, linux, servers

Automating startup of Darwin Streaming Server

Recently I have been using Darwin Streaming Media Server for some small movies. However, I quickly found out that when I rebooted the server Darwin does not automatically start up with it. It was necessary to start it manually each time the server was rebooted or started. Needless to day I find this very inconvenient. So I decided to write a startup script. It was really very easy, as you will see below.

Getting Subversion working remotely

I was having major problems getting Subversion to work when working remotely. After searching all over the place, I finally found a bunch of fixes that added together was my answer. So I am putting them here all here.

First, I am using the standard install of Fedora Core 4 with Apache 2 and Subversion from the ISO. (Of course you will need to make sure that you have Apache up and running.)

Categorized under: Uncategorized

My First Post to GeekyBoy

This is my first entry into this site.

In hopes of making a contribution to the IT field, and the world as a whole, I have created this site. I hope to keep it somewhat updated with things that occur in my life, and in the lives of the industry.

Enjoy the information here, and share with others.

Unique Web Sites, Inc.

RSSSubscribe to my feed now.

About Me

GeekyBoy.com