Asus PCE-N13 Wireless Card Ubuntu Linux 11.04 Instructions


I needed to buy a Wireless card for my desktop computer, and unfortunately… much to my dismay… despite there being *very* large lists out there on cards that more or less work with my version of linux (Ubuntu Natty Narwhal 11.04), there really wasn’t a list of *detailed reviews* as to indicate how well any given card works with linux.

Seems like an opportunity waiting to happen for someone that wants to put together a review site and curate what’s already kind of somewhat out there.

I went ahead and grabbed the asus CPE-N13. It was cheap, a brand name I recognized, and Wireless N (multiple antennas!).

Much to my dismay, the card did *not* work right out of the box. First, I had to blacklist some default but immature drivers that comes with ubuntu 11.04:

# Add these to /etc/modprobe.d/blacklist.conf

blacklist rt2800pci
blacklist rt2800usb
blacklist rt2x00lib
blacklist rt2x00pci
blacklist rt2x00usb

Pulled out the patch cable, rebooted for good measure… and voila we have wireless. :)

VirtualBox Not Handling Kernel Updates Well


I use VirtualBox from inside of Ubuntu to run Windows XP. After running an Ubuntu update I started getting this error:

* Look at /var/log/vbox-install.log to find out what went wrong

In the end the fix ended up being as simple as running sudo aptitude install dkms and then sudo /etc/init.d/vboxdrv setup

… but you wouldn’t have guessed that from some of the stuff popping up on Google. People were talking about reinstallation and all kinds of over-the-top “fixes.” That’s one thing I’ve noticed about linux is sometimes the solution can be really simple, but the signal to noise ratio on Google will be just awful.

Getting k9copy to work on Ubuntu (fixing segment 11 error)


K9copy is a utility to copy dvd media on linux. This is particularly convenient if you have a habit of inadvertently destroying every single CD or DVD you own.

After install k9copy on someones suggestion I was repeatedly crashing out with a “segment 11″ error whenever I attempted to use the wizard in the application. Apparently I was just missing a few packages.

The first step to fixing this problem is to first install medibuntu (from the documentation):

First add the medibuntu repository:

sudo wget –output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get –quiet update && sudo apt-get –yes –quiet –allow-unauthenticated install medibuntu-keyring && sudo apt-get –quiet update

Then if you want to add the medibuntu packages to the Ubuntu Software Center (optional) run this:

sudo apt-get –yes install app-install-data-medibuntu apport-hooks-medibuntu

Then, assuming you’re running Ubuntu 9.04 or later (you can check with lsb_release -a) install libdvdread4 and libdvdcss2 (also from documentation):

sudo apt-get install libdvdread4

sudo /usr/share/doc/libdvdread4/install-css.sh

After doing this k9copy stopped crashing for me with the segment 11 error. It would’ve been nice to have just been told which packages I was missing… Thank you power of Google, anyhoo!

Shortening the Linux Prompt in Ubuntu


I’ve been using my iPhone to do things on my desktop PC at home recently, mostly with the intent of actually being able to do web design/coding while on the run via my iphone.

One problem I’ve been running into is the default command prompt contains the current directory, as well as username by default on the Ubuntu distribution. While ordinarily this works just fine when you’ve got a nice big desktop monitor, on the iphone it takes up valuable screen space and tends to cause lines to double up unnecessarily when you’re deep in some subfolders.

So I decided I wanted to shorten it to a simple dollar sign ($), instead of the normal daniel@mdpatrick-desktop:/etc/sv/git-daemon$. (Mouthful, isn’t it?)

There’s two ways to go about this. The “normal” way is to just edit your local .bashrc file. You can do this by typing vi ~/.bashrc (or if you’re not sure what vi is use nano .bashrc). You’ll want to add something along the lines of PS1=’$ ‘ to the end of this file.

Learning Vi: Speeding Up My Text Editing


As I mentioned in a previous post about using SSH to edit websites, while ordinarily I use “nano” for all of my text editing I feel confident from the feedback of friends that vi is actually the better choice of editors. It requires a little more of a learning curve, but allows you to do ordinarily complicated things a little bit more rapidly.

To edit a file with the vi text editor ordinarily at a command prompt you would type vi filename.php or some permutation there of. If you start a new file then on the far left hand side of the screen it will show a series of tildes. These are placeholders and indicate an empty buffer.

When you first start the vi editor you will enter the text editor in “command mode.” This is the mode that makes vi quite special. Vi’s useful commands increase the number of things you can do from such an bland looking screen with efficiency.

In the videos from YouTube below, starting with lesson 1, the first command mentioned is called last-line mode. While in command mode, to enter last-line mode you press a :. The colon then appears at the bottom of the screen with your focus indicated by a blinking cursor (on the last-line).

A simple command to enter using last-line mode would be :q. This colon followed by a q, and then subsequently an enter key will exit from the program so long as there has been no actual changes to the file. If there have been, and you’d like to abandon the changes you will need to enter :q!.

Insert Mode

Insert mode is the alternative to the default mode, which is “command mode.” Insert mode allows you to insert text. As mentioned earlier, when you first enter vi you will default to command mode. In order to proceed to insert mode from which you can actually add text to that empty buffer of a new file, you must enter the insert mode command.

To do this, while in command mode you press the letter i. At this point, on the last-line the phrase “– INSERT –” will appear at the bottom of the screen.

Returning to Command Mode

After you’ve inserted the text of your choice, you may return to command mode via the esc button.

Interestingly, if you hit the esc button a few times your PC will make a tone to alert you that you’re already in command mode, and that pressing it a few more times doesn’t do any good! Kind of a neat audible feedback you can rely on even from most ssh clients.

Navigating Text in Vim

Basic navigation of text can be done using arrows keys to move up and down or left in right while in command mode. You may also use page up or page down (if you have those keys) to traverse text rapidly. Home or end will take you to either the beginning or end of a line, as in most text editors as well.

Traversing One Word at a Time

If you want to step forward in a text one word at a time you can press the w button (while in command mode). To move backwards one word at a time you just press the b button while in command mode. If you press b while on the first word of a line, then it will take you to the last word at the end of the preceding line.

No Home and End Keys? No Problem.

If you happen to be on a keyboard without home or end keys (if you’re editing from a smartphone, for example), or find them somewhat inconveniently out of reach you can press the $ button while in command mode to jump to the end of the line, and press 0 to jump to the beginning of the line.

To move the cursor to the top of the screen press H (as in high) while in command mode, to move to the middle press M, and to move to the lower part of the screen press L.

To move forward one full screen of text press control and the letter f. To move backward one full screen of text press control and b.

Navigating by Line Numbers in Vi

While in command mode (remember, press the esc button to enter command mode at any time) you can access the “GO command” to take you to any given line number… all you have to do is type in the number of the line you want to jump to followed by the capital letter G. So line 35, for example, you would jump to by typing 35G while in command mode.

A lot of useful tools on linux provide exact line numbers, so if for example, I use “git diff” from shell to see the difference between files staged for a commit, and files in a current working directory this will give me feedback involving exact line numbers. Using these numbers, in even large and confusing files, I can jump to exactly where I need to be using the “go command” in vi.

Deleting Characters on Vim

To delete characters to the right of the cursor while in command mode press x. In many windows text editors this would be roughly the equivalent to pressing the delete key.

To delete characters to the left of the cursor use a capital x. (So while in command mode, hold shift and press x).

Deleting Chunks of Text

If for some reason you happen to know the approximate length of the text chunk you want to delete that happens to be to the right of your cursor, while in command mode, and that number you’d like to delete is 45, then you can type 45x. Likewise, to delete 45 characters to the left of the current cursor then you’d type 45X (with a capital X again, to go to the left of the cursor).

Using the dw command to Delete Words

While in command mode to delete the word you’re currently on (beginning on and going to the right of your cursor) type dw.

Repeating Previous Commands Rapidly

Additionally, if you want to delete multiple words, instead of repeatedly typing dw you can then press .. The ., while in command mode, repeats your previous command as many times as you press it.

To delete from your current cursor position to the beginning of the line you’re currently on, you can press d0. Pressing d$, however, deletes from your current position ot the end of the line.

To delete the entire line you’re currently on, while in command mode, press dd. Yet again, to repeat the dd command, after issuing it once you can simply press the . button to repeat your last entered command.

Also, if you know the exact number of lines you want to delete, for this example we’ll say 15 lines… you could press 15dd, at which point the 15 lines following your current cursor downward would be removed from the buffer.
Continue reading

Editing Websites with SSH and an iPhone


Now that I’ve got a smartphone I’d like to actually be able to use it to edit websites. I’ve gotten to where I can SSH my main machine (which is running Ubuntu) at home as well as my webhost’s servers to edit my websites. Access to SSH is ubiquitous among most webhost providers’ servers.

iSSH for the iPhone Rules: It Has Alt, Ctrl, Del, and Arrow Keys (Important!)

I’ve got a cool SSH client on my iphone called iSSH — only a few bucks — that will also connect up to my desktop if I want to do something that requires a little more than the bash commandline. (Which, by the way, you can check what shell you’re using at any time by typing echo $bash).

Though, to be honest, using vnc for a view of the desktop tends to be slow and barebones. It’s way faster if I can get a good grasp of doing the things I need to do from the actual commandline since it boils down to only transmitting text. iSSH has the benefit of supporting important characters like the alt key, among other things, which is very useful for certain unix commandline — particularly the text editors, which are primarily used for direct editing of files such as css stylesheets, pdf, html, etc.

Logging Into a Linux Box with Dynamic DNS

My home IP address changes occasionally — though, not often. To make it so I could consistently find my home “box” I signed up for a DynDNS.org address which will allow you to login with yourownaddress.dyndns.org, which an app on your box can update automatically periodically ensuring that if your IP address changes you’re still available through the DynDNS address.

File & Directory Lists: Assessing Folder Size, Listing Files

Recently, when logging into my PC I realized I needed to liberate some space on my dropbox. I had to determine which folders. Ordinarily to list files I use this command: ls -alhF. This shows most of the information you’d ordinarily need, and includes options to make folders stand-out (-F), show normal file sizes (-h), show hidden files beginning with a . such as .htaccess (-a), and -L for longer listing.

However, even this well adapted version of ls I find that when working with the commandline in the unusual circumstance that I need to liberate space rapidly from a dropbox folder with many sub-folders, for example, ls does not show the file size of folders *beneath the current folder*, but instead only of the immediate files within the current directory. In order to see the space amount of space all of the directories take up counting all sub-folders and files it is necessary to use the following: du -h -c .

In this case, the . in du -h -c represents the current directory.

Commandline Text Editors: Vi, Vim, Nano

Though, I’ve been told by friends I really should learn vi or vim if I want to speed things up, I mostly just use nano. I’ll have to memorize some of the whiz-bang tricks for using vi to make it worth the switch. (See the vi cheatsheat) For the time being, however, nano is very intuitive, with it’s on-screen directions for basic commands. Vim, by the way, is just a sort of improved version of vi. For the most part the fundamentals are the same with either one.

Git is Awesome

One cool thing about using an iphone and SSH to edit pages, is almost every webhost, as well as my desktop PC has git on it. Which means that even as I edit the web page, whether I’m logged into my desktop or another server I can keep track of my changes, and if I make an accident which I may be a little more prone to use typing on the iphone’s capacitative screen, I can always roll back safely to the previous version.

This is really important because it eliminates the possibility of disaster and really makes doing editing from a smartphone a more viable option.

Other useful links:

Version Control: Git, Windows, and Dreamweaver


I’ve been doing some reading on version control, and had to make the choice: git… or subversion? Git…. or subversion. After reading subversion was supposedly “easier,” and find it not quite easy at all I decided to make the jump to git. I’m not quite there.. yet. However, gitref.org has been a big help. Read more about git at the wikipedia page if you’re unfamiliar.

Thus far I’ve been learning the commandline elements, which I’m comfortable with because most of the editing I do no longer involves any form of a wysiwyg (like Dreamweaver), and can in fact, be done from the commandline… Which is convenient, because I can access the commandline of my ubuntu desktop via my cell phone.

However, I realize that there may be times in which I may be working with people who I may need to share some form of version control with that do, in fact, use the Windows operating system regularly. (Admission of guilt: I still use Windows on my laptop too, so no false claims of being a total purist myself either.)

So, without further ado, enjoy a few relevant windows & git links:

  • TortoiseGit
  • GitWeaver – TortoiseGit… but from inside dreamweaver. Extension works with CS/CS2/CS3/CS4/CS5 (I think).
  • GitRef.org – Awesome git guide.
  • “git checkout” man(ual) page – I found this necessary because gitref didn’t cover checkout as well as some of the other stuff (which it did quite well).

Okay… Back to gitref for me…