Linux

symlink with FTP

Apparently you can't use FTP for symlinks? It's been so long since I have mucked around with FTP, that I didn't realize you could not create symlinks. I have an old site I still maintain and had to move it to a new hosting provider and the new provider did not give SSH access (well at least without charging for it). PHP to the rescue:
[php]
symlink('../gallery','gallery');
[/php]
Use the symlink command in PHP. Obviously you need to have the proper permissions, and since PHP may be running as a different user, your mileage may very. But it worked for me...

Posted In: PHP, Linux | 2 comments

Slicehost VPS

I signed up for a VPS on Slicehost today, and am very impressed. The interface is refreshingly basic and I was up and running in no time. Their articles are absolutely amazing, and worth the read even if you don't use their services. I know Ubuntu somewhat, but am far from an expert. Using the Ubuntu set up guide, I was up and running in under an hour. I made a stupid mistake when copying my public key and had to rebuild my slice. But that's the beauty of the cloud, just hit a button, start with a fresh install and go again.

I am testing it out, as I have a dedicated server which costs too much for the small number of low traffic sites I maintain. After going through all the articles on getting the basics set up, I altered my /etc/hosts file on my desktop to point to the IP address of my new slice, updated the ServerAlias in the Apache vhosts file to include the "slice" domain name in my /etc/hosts file, and then finally enabled mod_rewite (sudo a2enmod rewrite) so I could test out a site that was running Zend_Framework without having to actual point production traffic at it.

I then set up rysnc and get some database permission set up and tables copied over, and it was live. Talk about easy....

I looked at Amazon, and while it offers a lot of flexibility and they are developing more and more tools (instead of APIs), it just seemed like way to much work for my limited needs. Anyways, really impressed with Slicehost after just one day, we'll see how it goes in the next week or so. This blog may be moving over next...

Posted In: PHP, Linux | 2 comments

No Sound on Ubuntu 8.10 with Intel Sound Card

In addition to the problems I have had with KDE after my upgrade to 8.10, I also lost my sound. I have been trolling the Internet trying to find a solution and finally got it fixed after a couple days of frustration. I followed the instructions here for PulseAudio, and now everything seems to be working fine - well, at least I am able to get sound out of my speakers while listening to a CD and from Flash Movies on websites. Haven't tried an input device yet...

Posted In: Linux, Ubuntu | No Comments

Garmin GPSmap 60CSx and Ubuntu


I have had the Garmin GPSmap 60CSx for awhile and have always used the Garmin software on my windows box to get my waypoints off the Garmin handset and onto my computer. Truth be told, I barely use my GPS, but that is starting to change. To use it more, means I need to be able to get my waypoints onto my Linux box. Searching around, I found GPSBabel, and it works like a charm. Installing with apt-get was easy as always:

sudo apt-get install gpsbabel

Per instruction on this page, I used the following command to grab the waypoints and drop on my computer. Just make sure to use sudo, or you may get errors. Looks like an interesting program with lots of features. Looking forward to using it more.

sudo gpsbabel -i garmin -f usb: -o gpx -F waypoints.gpx

Posted In: Linux, Ubuntu | 3 comments

Ubuntu with RAID 1 and multidisk errors


I tried to upgrade my Ubuntu Server to the latest LTS and it wouldn't boot anymore. Did I mention that it was a software RAID 1, and probably not the most intelligent decision on my part since I had to manually set up the RAID 1. I had all the data backed up and decided to do a fresh install, since I had made a mess of the system over the last couple of years and this would be a good chance to re-install and get everything set up the way I wanted. Following this post and this post, I installed Ubuntu but ran into numerous errors when trying to re-partition and delete multidisks that existed from the previous install. I was headed nowhere fast with an unusable system...

I found this forum thread, re-booted and ran some commands. They seemed to work for the most part, however I got errors on the --zero-superblock. I tried the install again, and low and behold, the multidisks were gone and I was able to re-partition and create new multidisks. I am going through the install right now and hopefully wont run into any additional errors. Then its on to getting Apache, PHP, SVN, MySQL all set up. Need to decide if I want to compile PHP rather than install from apt-get...

Posted In: Linux, Ubuntu | No Comments

Open Office not working properly on Kubuntu 7.10

Ever since I upgraded to Gutsy Gibson (7.10), Open Office has been having problems. It would open fine, but everyime I tried to access the menu, the screen would redraw and the menu would disappear. It wasn't a huge deal, as I could shortcut most things, such as saving, undoing, bolding and closing the window. The deal breaker though, was the fact that I was unable to toggle between OpenOffice and other windows. This was causing problems as I like to take copious notes as I learn things about Linux. Being a relative noob, I had lots of notes to take recently while setting up SVN with Zend Studio for Eclipse, and getting rsync to push Subversion exports out to my prod server.

I finally resorted to using google docs to keep my notes, which I may keep doing. Finally I stumbled upon a posting that detailed how to fix the problem. Sounds like Compiz and legacy settings are the cause. Here's what to do:

  • Setting -> Advanced Desktop Effects

  • Scroll down to very near the bottom, and click on Workarounds (the icon is a bandaid :))

  • Uncheck Legacy Full Screen Support



Presto, no more problems with Open Office redrawing itself every time I try to access the menu!

Posted In: Linux, Ubuntu | No Comments

Firefox + JavaScript + Linux = BAD?

It can't be so, yet it appears to be, at least on my box running Ubuntu Edgy Eft... In trying to use Google Docs, Firefox repeatedly freezes and or takes forever to respond when using spreadsheets online. This could be a problem with the JS on Google Docs, but it runs fine on Firefox and IE on Windows. I have also experienced this problem on other sites that make use of Javascript. On a site that I developed which uses Thickbox, Friefox on Linux takes its sweet time bringing up the images, but runs smoothly for FF on Wndows. I experienced the same problem on this site with a different Linux box that was running Fedora Core 4, so its not just this distro or version of Firefox. There is mention over at O'Reilly about FF crashing on Linux, but that isn't the problem I am having. It's simply a matter of Firefox taking forever for certain sites with JavaScript.

Posted In: Linux, firefox, Ubuntu | No Comments

301 Redirects with Apache .htacess file

I've just spent more time than I care to in the last couple of days trying to figure out rewriting urls with Apache, both through .htaccess files and directly in the conf file. Today was relatively painless, as I just had to come up with a way to 301 redirect all “extra domains” and some specific pages. For good measure, I also wanted to redirect non “www” domains to the canonical domain and also allow for future, yet unknown domains to be redirected. Here is what I came up with for an .htaccess file:



RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]
redirect 301 /log.php http://www.yourdomain.com/fog.php

Pretty simple – the RewriteCond looks for any domain other than the one specified and upon matching, invokes the RewriteRule. The RewriteRuule simply uses a 301 redirect to the domain. The last line just redirects to a specific page. Looking at the output of Live HTTP Headers for firefox I noticed that it issues two 301 redirects if someone where to type http://www.extradomain.com/log.php. One redirect to get the proper domain, http://www.yourdomain.com/log.php, and then a second redirect for the actual page. Not a big deal, but I thought it would handle it all in one redirect since I wasn't using the L flag. I know, I have a lot to learn when it comes to mod_rewrite...

On a side note, why is it soooo diffucult to get 301 redirects in place from other people. Domain registers seem to only use 302 redirects and whenever I request a 301 redirect for a domain from another company, I either get silly responses like, “You can use the PHP header function to do a 301 redirect” (these are sites with a lots of individual html and php files, not a app running with a front controller) or it ends up being a 302 redirect.


While I am complaining, I might as well mention the bad behavior I experienced while cooking up some redirects. On my Fedora Core 5 desktop, I edited my /etc/hosts to include the domains and then set up a virtual host with aliases for the domains on my Apache server – this allowed me to use my browser and test the redirects locally with Live HTTP Headers. It seemed that the redirects would occasionally get cached somehow? Not sure whether it was my browser or on the server, but I was changing the .htaccess file and the changes would not take effect. If I cleared my browser cache/cookies AND restarted Apache, things seemed to clear up. But I thought Apache read .htaccess file on every request, and thus, changes should instantly take effect? If it was Firefox, then why didn't clearing the cache/personal data have any reliable effect? Maybe it was my desktop? Who knows...

Posted In: Linux, Fedora Core 5, Apache | 2 comments

Linux Desktop Magazine

Tux Magazine, covering all things for Linux Desktops, just annouced they are moving to a paid version starting in 2007. I have been reading the magazine for the past couple of months and enjoy it. I'm not sure if I will become a paid subscriber, but at 83 cents an issue, it is hard to pass up. Of course, they are taking some heat from some people for switching to the paid model. But can you blame them? They are a company, companies employ people and most people like to get paid. If you don't want to pay the money, don't.



I believe they are still offering free subscriptions for the duration of 2006 and I recommend you subscribe to it now while its free. That way you can get a taste of what the magazine is about. They also have back issues available.

Posted In: Linux | 1 comment

Installing MySQL Query Browser on Fedora Core 5

I was visiting my parents back in Vermont last week, but right before I left I decided I wanted to install MySQL's Query browser. Running mysql from the command line works, but sometimes it is nice to have a GIU, especially since the program has help docs for syntax, multiple tabs open with queries and expandable table views (I always forget the names of rows in my tables while writing queries).



Fortuitously, I decided to search around before installing the program, and I quickly realized it wasn't as easy as issuing a yum command. I located a binary suitable for Fedora Core 5, and issued “ yum list installed | grep gtkhtml” and “yum list installed | grep gtkmm” to see if I had the prerequisite programs (gtkhtml3 and gtkmm24), as listed on the website with the binaries. I didn't have either of those, so I ran “sudo yum install gtkhtml3” and “sudo yum install gtkmm24”. Once those were installed, I downloaded the binary and MySQL Query Browser is working fine. Looking at the output from the previous yum list installed command, I have gtkhtml2, gtkhtml3 & gtkhtml36 - I can't remember now whether I also installed gtkhtml2 and gtkhtml36 for good measure, or if they were already there...

Posted In: Linux, Fedora Core 5, mysql | No Comments

Setting up Fedora Core 5 for Zend Framework

I installed Apache and MySQL through yum without a hitch and decided I needed to compile my own version of PHP 5. I ran into some problems compiling PHP5, but after resolving those, I had a working LAMP platform. The way ZF is currently set up, it really only works from the root directory of a site (you can use modified controller to get around this), although they are going to change the controller structure so it works in sub-directories in future releases. I have two different sites I want to build using ZF, so I decided to edit my /etc/hosts file to tell my computer to look at itself for two domains:

www.bolton.com localhost
www.tripvera.com localhost



Fedora checks /etc/hosts first when a domain is requested, so a matching line here will prevent it from querying a DNS server and allows you set up any domain you want, even if you don’t own it. You can also use the GUI in System->Administration->Network to add the same entry.
Now I had to modify httpd.conf (use “locate httpd.conf” if you are unsure where yours is) and I uncommented the virtual hosting line in the file, added the virtual directory and placed the mod_rewrite rules into the virtual host, rather than using an .htaccess file in the directory:


ServerAdmin your@email.com
DocumentRoot /var/www/html/bolton
ServerName www.bolton.com
ErrorLog logs/bolton.com-error_log
CustomLog logs/bolton.com-access_log common

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
AllowOverride All



Make sure to restart Apache to have the changes to httpd.conf take effect. Finally, I created a new file called .vimrc in my home directory and added “:set tabstop=4”. This is a config file vi opens whenever it is loaded and that command sets the tabs to 4 spaces, which is the recommended amount by ZF. Vi defaults 8 spaces, which I think it way too much and I use vi a lot for coding. I have been playing around with Eclipse, but that is a topic for another posting…

Posted In: PHP, Linux, Fedora Core 5 | 2 comments

Installing Flash on Fedora Core 5

Just started using Fedora Core 5. I installed it a couple of weeks ago, but have been working a lot and haven't played around much with it. I decided I needed to install flash and downloaded it from Adobe. I untared the file and followed their instructions, but it didn't work. I also tried issuing a "yum install flash-plugin", but that failed to actually download and install anything.



After searching the internet, I found the answer. I had to add a new repository and then yum would work. Went into /etc/yum.repos.d, created a new file and entered the following text and then yum worked like a charm:

[macromedia]
name=Macromedia for i386 Linux
baseurl=http://macromedia.rediris.es/rpm/
enabled=1
gpgcheck=1
gpgkey=http://macromedia.mplug.org/FEDORA-GPG-KEY


Posted In: Linux, Fedora Core 5 | 2 comments

Fedora Core 5

I finally got off my ass and installed Fedora Core 5 on my desktop. I had an early attempted foray into desktop Linux about 2 years ago, with a dual partition of Fedora Core 2 and Windows 2000. It worked alright, although I used Windows more than Linux and I ran into a couple problems installing different pieces of software on Linux. Then my hard drive failed, and I never bothered to really get my desktop up and running again, instead relying on my windows XP laptop.

This time around, I am somewhat more comfortable with Linux, although I still have a long ways before I am a power user. I am not bothering to install Windows and am going to try and use Linux almost exclusively. Notice the word “try”: I always seems to run into small problems with Linux, due to my unfamiliarity with it. But this time around, I think I can work through them. Besides, I need to learn Linux better and most of the programs I use now are open-source (Eclipse, Open Office, Firebox).

Posted In: Linux, Fedora Core 5 | No Comments