Way back I did a quick tutorial showing how to pair the Apple Wireless Keyboard with Ubuntu 9.1. Yikes the releases go by fast. That post had some serious loopholes and did not allow for automatic pairing on start up and after sleep mode. This new method includes all of this, but is slightly more complicated, although more solid than my previous post. First, upgrade/install your machine to Ubuntu 11.04. Everyone (including myself) seems to have the most luck with this release. This solution is also great as it does not depend on non existant Bluetooth files in earlier packages.
Start by making a copy of your Bluetooth script located in /var/lib/bluetooth
Now remove all Bluetooth packages:
sudo apt-get purge bluez blueman gnome-bluetooth bluez-utils
Now install Blueman and Bluez from source. You can look these packages up online. Compile (you have to do this for both packages separately of course) by unzipping these packages and typing the usual:
sudo make install
Copy your old Bluetooth script to /etc/init.d (with premissions 755)
Then add Blueman to your startup programs and reboot. The keyboard should now auto pair on sleep and boot. Pretty Cool.
After hearing that GCC had been ported over to the iPod Touch/iPhone, I was intrigued. GCC has always been my favourite compiler, and I think its pretty neat to have it installed on your iPhone/iPod Touch. I just finished setting it up on my touch and I will admit, its pretty cool. There’s not a whole lot of information about this on the web, it looks like there only a handful of people interested in this. Its not the most practical thing, but it is still nice to have. I guess if you wanted to get serious, you would simply cross compile all of your code. I will also mention that it has MAJOR issues. Unfortunately it does not even include the standard iostream file, for c++ programming. Pretty useless, but that can be simply installed later. For those of you who want to install GCC, it can be installed through Cydia. Make sure you have your settings set to “developer”, or you will not be able to find it in Cydia, the package name is “GNU C Compiler”. Once you search it (it can be found under “Development”) you will find that it cannot be installed. It depends on “libgcc” which cannot be found in Cydia. My understanding is that since the package is not incomplete and buggy, libgcc has been removed to discourage you from installing it. In order to install all the prerequisites for GCC, libgcc must be installed. Fortunately, a libgcc deb package has been created for this very propose! It is called “fake libgcc”. I thought I would have difficulty finding a libgcc deb file that has been ported to the iPhone, but I did (Google is the best!). Just do a quick search. After you have the file, simply SSH into your device. Upload the deb file to the root directory and run dpkg. Still in the root directory, run dkpg -i fake-libgcc_1.0_iphoneos-arm.deb (or whatever your particular libgcc file name happens to be). That’s it. You can now install GCC right through Cydia. Like I said before, the package does not include the standard iostream library. I am trying to figure that out, as you can’t program in C++ without it, obviously. I have not tried compiling a C program yet, but I doubt stdio.h is included either. If it does I don’t imagine it works. Like I said before, it appears to be VERY buggy. It doubt installing the headers will be very difficult, I imagine you simply download the header and SSH it to the appropriate location. Although, I’m not quite sure where that location might be… Hopefully I can get the iostream headers to work, because I think this is pretty neat!
Today, I got my shiny new Apple Wireless Keyboard. I just completed the setup, and it went fairly smoothly. There are plenty of tutorials on the net about pairing this keyboard with Ubuntu, but none (that I could find) on specifically pairing the keyboard with version 9.1. If you follow this tutorial in 9.1 you will run into a few problems, as you will be missing a few files. The Bluetooth file structure is a little bit different in Karmic, and there are a few configuration files you might want to edit, but will be unable to find. This includes the “hcid.conf” file and the “default bluetooth” file as well. Okay, the first step to paring your keyboard is to install “bluez-compat” and “bluez” (these are separate packages). Both packages can be found in Synaptic, or by typing:
sudo apt-get install bluez-compat bluez
to make sure that your Bluetooth dongle does, indeed detect your keyboard. It should be called “Apple Wireless Keyboard”. At this point you should make sure you have both packages installed, or this will not work. Now, simply go to your terminal and type:
sudo hidd --search
The “sudo” part is VERY important because if you do not use sudo, you will get a “permission denied” error. Of course you could login as root if you really wanted, but we all know how dangerous that is! After it connects, you should be paired automatically. Some people have directly used the GUI package “Blueman” to configure their keyboard, but that did not work for me. The default Bluetooth manager in Ubuntu seemed to work even worse. And that’s all there is to it! Now that you have successfully paired the keyboard, the next step is to write a simple shell script to connect the keyboard without typing the full “sudo hidd –search” command. Simply open up your favorite text editor (Nano of course!) and write the following:
sudo hidd --search
Give the script whatever name you want, just make sure it is saved “.sh”. I called mine “keyboard.sh”. Make the script executable, then edit your sudoers file to add an exception to the “hidd” command, so you can run the script as root without a password. Whenever you wish to connect the keyboard you can simply double click the script and pair your keyboard! I have included an some pictures below, as well as an image of my keyboard script. If you ran into any issues leave a comment below. Happy Typing!
One thing I like to do when I work for hours and hours to solve a major problem/bug, is that I like to blog about it. This way I can document the solution, and allow others to solve the same or similar problems. So: you were happily going along (maybe adjusting) your database (like I was) and something goes horribly wrong. You go to your site and see the message. “Database error: cannot connect to MySQL.” Don’t worry. Now a lot of you are probably thinking by now “oh no, I have to reinstall”. This is not true. OK start by pulling out a backup of your database. Once you have that, simply make a new database. Using the “PHPmyAdmin” tool, select your new (empty at this point) database. Click on the “import” tab and select your backed up database. This should run a series of queries on the new database, and dump all your information into the new database. What we have just done, is create and identical database, but we have started from scratch allowing the site to connect to it again. Now, go back to your database wizard and create a new user for the database we just made. Remember the user name and password. OK, for all you Joomla! users find your “configuration.php” file. It should be somewhere in the root directory. If you are using WordPress the file is called “wp-config.php”. Whichever you are using set the permissions of that file to “777″. I know some of you are going “that makes my site venerable to hackers”. Yes it does, but we will changing the permissions back, in a few minutes. Now open that file up, and change the database name (to the new one we just made) and then change the database user (to that databases new user, the one you also just made). Next change the database password (to the password of the specified user). Your done! Go to your site and you should be connected and running again. This works whenever your database becomes, deleted, corrupted, or has missing files/incorrectly named files. As you can see, it is important to take lots of backups. If your backup is a month old, you loose a month of content, so take LOTS of backups. Your done!
Oh, and don’t forget to set the permissions of your configuration file back to the way they were!