Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, January 8, 2025

Using the vi Editor

It is not every day that I have to edit large blocks of code. Usually I will put together a few lines of SQL or Python and pretty much any text editor will do. Today I put together a 450-line SQL statement and so I pulled out my favorite code editor: vi.

A common mistake with vi is how it is pronounced. Technically it should be pronounced as the two letters "V" and "I" but some try to pronounce it as a single-syllable word that rhymes with hi. Another common mistake is that it is difficult to use. It does have a pretty ugly learning curve for beginners but once you learn how to use it, it is significantly faster than most other text editors. Why? Because you never have to take your fingers off the keyboard. If you know how to touch type, you know not having to pull you hands off the keyboard to use the mouse or cursor keys can be lightning fast.

The vi editor evolved with the Unix operating system and became the de facto editor back in the 1980's. That is when I started doing technical support for Oracle running on Unix systems. My boss sat me down and made me learn both Unix and vi. The main point of confusion is getting used to being in command mode or edit mode. In command mode, all the letters of the keyboard have a specific function. The letter "h" moves the cursor to the left, "j" moves the cursor down, "h" moves it up, and "l" moves it to the right. Once you get used to that, you never have to take your hands off the letters to use the cursor arrows to move the cursor. It does take a lot of practice though.

To get into edit mode, you just hit the "a" or "i" keys. The "a" stands for append which allows you to add more characters after the cursor where "i" is for insert and adds characters before the cursor. Then to get back to command mode, you just hit the "ESC" or escape key. Once you play around with vi for a bit, your left pinky finger can find the escape key fairly quickly.

There are some other quick shortcuts that make editing code very efficient. If you want to delete the current line, just double tap the "d" key. If you want to copy the line, double tap the "y" key, which is short for yank. Then to paste either what you have deleted or yanked, use the "p" key and vi pastes the line below your cursor. If you made a mistake with what you deleted or pasted, just hit the "u" key and it will undo your last command. Hit it a couple of times and it will undo the previous couple commands.

Up until now, nothing seems that groundbreaking. The real power comes from prefacing any command with a number. If you want to move the cursor down 5 lines, just type the "5" key followed by the "j". Want to copy or yank 10 lines, just type "1" followed by "0" followed by "y" and followed by "y" again. Then when you want to paste them, just go to the line above where you want the copied lines to be inserted and type "p".

Then there is my favorite vi command: the do-it-again key which is the period or "." If you copied something and want to paste it several places in your document, just copy the line and move the cursor to the line above where you want it to go and press "p". Then move to the line above the next place you want it to go and hit the period key. If you want 5 copies of the line, hit "5" followed by "." and you will see 5 identical lines below your cursor.

Now I recognize that vi would be horrible for creating a term paper for school or any document for that matter. So I don't recommend it for a general-purpose editor. It has evolved over time though to be a very efficient code editor and that is where it excels. It is available for Windows for free and comes installed on all Mac and Linux machines. Most people know it as Vim, which is just an enhanced version of vi with color coding and a few other goodies. If you need to create code, get familiar with it and you might learn to appreciate it. Just don't be turned off by the difficult learning curve.

Monday, November 11, 2024

An 8-Year Old with 8 Computers

Yesterday I talked with one of the kids in my neighborhood who is about 8 years old. He talked about how he had 8 different computers. Naturally I asked how he came to be the proud owner of so many computers. His dad answered that the local thrift store, Savers, sells used computers for around $5 and an amazing number of them actually work. That made sense and for a kid totally interested in computers, he probably loves playing with them as a hobby.

My next question amounted to what he does with all of them. He responded that he installs different operating systems. This got my mind wondering. While I imagined he played with Microsoft Windows, I wondered if he knew about the many other operating systems available for standard computers. I followed up with which is is favorite. He surprised me by answering MacOS.

While you can install MacOS on some Intel-based computers, it requires very specific hardware and I asked about that. His father responded that he has played with Hackintosh but it didn't sound very successful. That implies that you can find Mac hardware at Savers which is what is required when installing MacOS. I may have to go see if I can find a decent computer for $5.

Next I asked about Linux as that is an obvious choice for older Intel-based computers. The young man mentioned that his favorite flavor is Ubuntu and it impressed me. There are quite a few variants but Ubuntu is my current favorite flavor of Linux.

I remember being young like that and having a huge interest in computers. My dad did too and we actually had a large computer in our house. Back then it looked like 3 refrigerators and 2 dishwashers next to each other. It had a total of 256 kilobytes of memory and 20 megabytes of hard disk space. Calculators have more memory and storage than that now.

It is always interesting to see young people interested in computers and my neighbor surprised me. I enjoyed talking with the little guy and wish him the best of luck as he learns about this magnificent technology. My hope is that he continues with the hobby as it will serve him well later in life.

Wednesday, October 18, 2023

Storing Electronic Files

Ever since my first computer I have had to work hard to best organize my electronic files. It started with school papers that I thought I would want to keep around forever. Then the problem seemed to explode as film cameras gave way to digital ones and I started storing photos on my computer. Throw in how to best keep e-mail messages and you can see how having a good filing system is required.

Back with my original computer I used floppy disks to store all my school papers. The documents never got very large and so I could use one disk for each class. Even if I still had those disks, I don't have a computer that can read them. Computer operating systems evolved to have a default storage directory or folder for your documents, appropriately named "Documents." There are also picture and movie folders. You can then nest folders inside of other folders to help you organize your electronic files even more.

In my pictures directory I have created a number of folders by subject. I have one folder that I use to store all the pictures of my grand kids and another for my trips to Disneyland. What happens when I take pictures of my grand kids at Disneyland? This is why it is important to have a good filing system. Unix and Linux allow you to easily create symbolic links. This means you can have one file with links to that single file appearing in multiple directories. Unfortunately that is a lot of work to set up when I am just dumping photos onto my computer. Instead I just know all photos related to a trip will appear in the trip folder even if they contain pictures of my grand kids. The "Grand Kids" folder is just the repository for all other pictures of my favorite little people.

What about multiple trips to Disneyland? That is easy. I have a top folder named, "Disneyland," with sub folders inside listing the dates of each trip. I should probably do something similar with my grand kids folder so I know which kid is who while I can still remember. Once kids get older they become much more difficult to differentiate between siblings. I'll save that for another day.

Finally there is the dreaded e-mail organization. I am one of those people that just keeps everything important in my "inbox" until it is no longer needed. Speaking from experience, that is a horrible way to store e-mail. Every week or so, I will go through and delete unneeded e-mails. I also have other mailboxes that relate to major categories. My work e-mail has a mailbox for each project I am working on. My personal e-mail has categories like skiing or Sony, should I receive a work e-mail in my personal account. About once a week, I take an hour and go through both e-mail accounts and move messages from my inboxes to appropriate mailboxes. A lot of the time I will delete messages as they become irrelevant. If I am really on top of things, I will move a message into the appropriate mailbox as soon as it comes in, which is ideal.

So what is your best electronic file storage tip? I'd be interested to know as it may help me. I'm sure others would be interested too. 

Wednesday, March 29, 2023

My Favorite Short Cut: ALT-TAB

You can tell how long someone has been using computers by paying attention to the short cuts he/she uses to navigate on the computer. I usually have quite a few application running on my computer and I need to be able to quickly switch between them. Back when dinosaurs roamed the earth and Windows 3.0 first came on the market, I used to only have one or two apps running and could easily just click between them. It didn't take long to quickly exhaust that functionality, especially with the small screens on laptops we had back then.

I remember leading a training session on a new database tool and I kept having to switch between a PowerPoint presentation and the tool. I would escape out of presentation mode, minimize PowerPoint, and show my demo. Once I completed the demo, I would expand PowerPoint and go back into presentation mode. Then someone showed me the power of ALT-TAB that allowed me to instantly switch between all running applications. I thought it was great and still use that key combination today even though there are more advanced ways of switching between running applications. For instance, you can see the running applications in Windows by just looking at the toolbar on the bottom of your screen. I still prefer ALT-TAB.

There are a number of other computer short cuts that will give away the length of time someone has been using computers. My work laptop run Microsoft Windows but I am an old Unix guy. When I open the Windows Power Shell it is a hard to remember not to use the "ls" command to get a directory listing of files instead of the preferred "dir" command familiar to those who learned "DOS." Fortunately Power Shell understands both commands and so I don't get the old "Syntax Error" I used to.

Another trick that really shows how old I am is from when I started using Oracle version 4. When you wanted to get a list of all the tables in the database, you would run the following command:

SELECT * FROM tab;

The result was a very simple listing of tables and some other basic information. Oracle later added more complete table definitions but I still use this simple command. Why? Because it is so simple and easy to remember. Are there better ways to find out what tables are in your database or schema? That depends upon how you define better. If you have to go to a manual and look it up, nope.

I used to work for a company that took PostgreSQL and made it look like Oracle for a lot less money. The first thing I tried when I sat down to play with the product was the command listed above. When it worked, I knew there were others at the company that appreciated quick and simple. I also knew they had people on the development staff that had used Oracle for a very long time, an important fact to me at the time.

Tuesday, February 19, 2019

Hackery vs. Mastery

Several years ago I had the pleasure of having lunch with Mark Shuttleworth, the CEO of Canonical which is the company that develops Ubuntu Linux. The conversation turned towards "Hackery vs. Mastery." Sometimes the forms of the word "hack" are positive and sometimes they are negative. When someone hacks your bank account and steals all of your money, it is a bad word. When you work to hack together a good solution to a complex problem, it is a positive word.

Our discussion put the word "hack" in a negative light as we discussed how sometimes people will hack together a solution instead of taking the time to do things correctly. A short while after our discussion, I had the chance to work with another group in our company that is famous for hacking together solutions. They prided themselves on building software quickly. Unfortunately none of their projects ever had to last very long and so as our team worked with them, we had to help them move from hackery to mastery.

It is very easy to throw together software proof of concepts that serve as a model for how the finished product should work. It is quite another to actually build production software that can hold up to the pressures of large-scale use. Think about something as simple as a database. While you are building a proof of concept, you don't have to worry about data loss. If something goes wrong, just reinitialize everything and keep testing. Put that same system into production and you need to make sure you are taking regular backups. If it is important data, you may want to leverage replication to a standby database that can be switched at a moment's notice. Then if something goes wrong, you quickly swap out the dead server for one that has all of the data and is still running.

Sometimes mastery can mean extending the development time significantly. This group I had the pleasure of working with didn't comprehend that. They couldn't understand why other parts of the company took so much longer to do the same thing they could do so quickly. Once we started educating them about all of the possible scenarios and what could go wrong, they discounted our advice. Then we moved from prototype to production and they saw that some of the concerns we had actually had merit. It only took one or two issues to arise before they started looking at things the way we saw them. Ultimately we all became software developers from the experience and that is part of the path towards mastery.

Wednesday, November 21, 2018

Which Flavor of Linux

This week I have been working from home and been doing some playing around with machine learning (ML) in Python. My home Linux box is using an old version of Fedora Core while my machine at work uses Ubuntu Linux. I am having problems getting Python updates to work correctly because some of my system libraries are so old. It is time to update my Linux and I am wondering which version to select.

I started using Red Hat Linux a long time ago. I don't feel the need to pay for Linux as I don't use it as a production server and so I have been running Fedora Core, which is based on Red Hat. If I want to continue using a Red Hat flavor of Linux, I could also install CentOS. So should I stay with Fedora Core or change to CentOS?

As mentioned, my machine at work uses Ubuntu which is based on the Debian distribution of Linux. I like it and it stays updated fairly easily. There are several other options as well but most of the world has settled on Debian or Red Hat. Suse used to be an option but Novell did a pretty good job of killing it in the early 2000's.

So what is the difference between them all? Mostly it has to do with system administration. PC users don't really want to do a lot of system administration work but they do like to install new versions of software. Red Hat uses "yum" to install software while Debian uses "apt-get". The programs are very similar. I have never had a problem finding updates for either flavor of Linux.

One problem I have noticed with Fedora Core is they are constantly changing versions. You may be on version 22 only to have version 23 come out a few months later. Updating your operating system can be a bit of a time sync as you have to make backup copies of your files and then spend hours making sure everything got moved to the same version without any problems. Ubuntu doesn't have that problem and so I think I will make that change over the Christmas break when I have more time. Until then I will have to remote login to my machine at work when running through my ML exercises. You may disagree and I would love to hear why. Feel free to send me a comment.

Thursday, October 18, 2018

Cleaning an Old Computer

For the past several years I have had an unused computer sitting under my desk at work. The power supply failed and I never bothered to replace it. Instead my company just got me a new Linux desktop and my change in responsibilities meant that I didn't need anything off the old one. This week I finally got tired of having a useless computer and so I had our IT department take the old computer away. I also asked them to pull the hard drive out and see if we could pull anything off it. They couldn't and so I resigned myself to have lost anything of importance off that computer. As a last-ditch effort, we put the drive in a new computer and tried to boot it. Guess what? That worked.

Going through the files on the old computer disk felt like traveling back in time. It reminded me of how my current work is so different from the work I originally got hired to do. My old disk had about 57 Gigabytes of files. I sorted through it rather quickly and copied import stuff to my relatively new Linux box. Anything that I knew I didn't need, I deleted. Then just to be safe, I saved everything else and will put it in a safe place in case I need it again.

Cleaning off an old computer is something I usual when I get a new one. I often find that I place more value in stuff I won't actually need. Having my useless computer sitting under my desk helped me realize that I should be a lot more discerning the next time I have to clean up an old computer. After all, if I have not needed something in a 2-year period, chances are I won't need it any time soon.

Thursday, January 19, 2017

No Exciting Computers

I had a bit of time to think as I walked the 3 miles to my office this morning. Mostly I thought about how I had already crossed the threshold of distance to where summoning Uber seemed a waste even though it was raining. What driver would pick me up for such a short drive. I did think about other things and one of them surfaced again when I go to the gym at work and prepared to get another 30 minutes of exercise. I briefly glanced at the locker-room TV and noticed that one of the ESPN commentators has the same laptop I do. It seems like the vast majority of people have settled on the same few laptops. There just doesn't seem to be any exciting new computers these days.

Naturally I have spent part of my day thinking about the state of computing hardware and what would make me excited. The size of a laptop is something that used to differentiate various models. Now it seems we have settled on small, medium, or large and each has its merits. We also used to have peripherals such as floppy, CDROM, or DVD disk drives. Now it seems that everyone relies on network connections and doesn't need removable media any more. What about case material? Well you have the brushed aluminum look, solid black carbon fiber, or some colored plastic cover. All of that is boring. About the most exciting difference between laptops is the lit brand logo that appears on the back of the screen. Some love the simple Apple logo while others prefer the 3 intertwined-snakes for the gamer specific Razer laptops.

As I thought about the lack of excitement in the computer market right now, I realized that we can't really blame the hardware manufacturers. It is tough to get excited about new hardware when it all runs the same old software. You have your choice between Windows, MacOS, or Linux. Even then Linux really isn't an option for most people as it is still more of a hobbyist's operating system unless you are working with servers.

So what will it take to get me excited about a new computer or laptop? I don't know. Perhaps this just means there is a new opportunity out there for something extraordinary to come along. I would hate to think that computers have evolved as far as they will go.

Wednesday, June 3, 2015

Pandora vs. Spotify

My kids introduced me to Pandora streaming music several years ago and I have to say that I like the service. Recently another service has been gaining in popularity called Spotify and so I thought I would give it a shot. Once again it was my kids that told me I was behind the times and should move to Spotify. When I asked them why, they gave a number of reasons and so I thought I would check it out for myself.

My primary usage for streaming music is during my daily workout session. It makes getting on an indoor bicycle much easier when there is something upbeat to listen to. I never listen to music unless it is on a stationary bike inside a building. That means I always have a WiFi connection to the Internet. Riding outdoors with earphones on is a good way to get hit by a car or another cyclist. My preferred platform is my Android phone.

A second reason for listening to streaming music isn't really for music but for comedy. This is generally done as I travel to and from the airport using public transportation. It also means there isn't any WiFi and I use my phone's LTE Internet connection. For this, I will alternate between my iPhone and my Android phone. It just depends on which one is more easily reachable.

Finally, when I am working from home I like to listen to music and so I will have some sort of streaming music during mundane tasks that don't require much thought like doing expense reports. This is generally run on my Linux computer as I have a really nice sound system connected to it.

Given this background, here are my simple and initial observations:

I started listening to Pandora first and so I have the most experience with it. My memory of it initially is that it is very easy to set up. I created one station called "A Little Bit of Everything" where I entered a number of artists that I like and Pandora plays music from those artists as well as similar bands. After a while I found that my taste in music is so varied that I often end up listening to a lot of stuff I don't really like. Instead of constantly rating songs with the "thumbs down" button, I created a new station for just one artist: Angels and Airwaves. Pandora streams me music from Blink 182, Boxcar Racer, +44 as well as Angels and Airwaves along with other similar bands like Simple Plan. It is great music to listen to while working out.

When my kids had me look into Spotify, I set up an account on my Linux box and was immediately turned off as I was told to download the Spotify computer program. With Pandora I can just use my browser and don't have to install anything. Both streaming music applications require apps for smartphones and provide them for both Android and iOS. I assume they are also both available for Windows Mobile devices but don't really care. I don't have one of those, nor will I ever.

The first platform I loaded Spotify onto was my Android phone and it was a painless process. I typed in "Angels and Airwaves" into the artist section and saw a listing for a number of songs from that band and only that band. I assume that if I wanted to add Blink 182, I could do so but have not played around with the app enough to figure out how to do it. I did notice that there are a lot more Angels and Airwaves songs than I have heard on Pandora and so I believe there is a lot more music to choose from with Spotify, it just takes more effort to set things up the way you want them.

My son claims that Spotify has higher quality music than Pandora. At first I thought that meant more music song choices. Then my son explained that Spotify uses a higher sampling rate for their music and so the same song on Spotify will sound better than on Pandora. I'm not sure about that as they both sound pretty good to me. Perhaps I need a better set of earphones to tell the difference.

Currently my Spotify experience is rather rudimentary and so I still need to spend more time setting up the service. My initial impression is that if I take the time, it will be a lot better than Pandora, I just haven't done so yet. Until then it is easier to continue listening to Pandora and occasionally switch to Spotify when I want a more concentrated "Angels and Airwaves" experience.

Thursday, March 20, 2014

Running Something Other Than Windows 8

My wife is fed up with trying to run Windows on her new laptop. I spent some time last weekend playing with it and have to agree that Windows 8 is a giant step backwards in the evolution of operating systems. This week I have spent some time looking at alternatives. There are basically 3 choices when it comes to PC operating systems: Windows, MacOS X, and Linux/Unix. I will be working from home next week and will have more time to devote to my wife's computer and will see what I can get running.

There are a number of tutorials on how to get Windows 8 into a usable state. Just use your favorite search engine and use the following key words: Making Windows 8 Usable. With everyone so dissatisfied, I can't believe it is selling any product.

When you look at a Mac computer from Apple, it uses a lot of the same hardware as a normal Windows PC. Therefore you should be able to run the Mac OS on a carefully assembled PC. You can, and to prove it, there is the Hackintosh website to help you get started. Unfortunately this is more of an option if you are building a desktop as opposed to trying to get it to run on an existing laptop. There are some laptops that work better than others but my wife's model is not among them.

The next option is to throw away Windows and run Linux on the laptop. Unfortunately Linux can be much more difficult to use than Windows. Fortunately there is a UI that is easily installed on Ubuntu Linux that makes it look like a Mac and it is called Macbuntu. I will give that a shot and see if my wife likes that.

I should have an inexpensive laptop that my wife can use by the end of next week. I promise that I will give Windows a fair shake as there are a number of people who think it is awesome (I guarantee you that they are the same people that ate paste in kindergarten but are just grown up now). Look for an update next week.

Friday, August 16, 2013

Finally Fedora Core 18 Is Usable

A few months ago I decided to update the Linux version on the desktop computer in my home office. I used it as a chance to decide if I wanted to stick with Fedora or move to Ubuntu. We are moving from CentOS to Ubuntu at work and so I wanted to start with Fedora just to be able to compare and contrast multiple flavors of Linux.

Unfortunately the upgrade from Fedora Core 10 to Fedora Core 18 was not painless. There was the problem with importing my old e-mail that I was able to figure out. The worst problem appeared about a week after the upgrade. For some reason, my Firefox browser kept crashing. I thought I could just download Google's Chrome, but that didn't even load. Previously I had been running the 32-bit version of Linux and upgraded to the 64-bit version. I figured there was some library mismatch in the 64-bit versions of the software and that by constantly sending crash reports to the developers, it would eventually get fixed. In the mean time, I just used the browser on my laptop.

I work in the Bay area during the week and fly back to Utah on weekends. Every Saturday, I would patiently update my system only to discover the bug with my browser hadn't been fixed. One perk I have with my job is that I get to work from home one week per month and this was that week. On Monday, I gave the old update a shot and cranked up the browser. I let it sit there and several minutes later the browser was still running. Next I cranked up Pandora and filled my office with music. It has been running all week with no crashes. I have yet to give Chrome a try, but I don't like Chrome and avoid it if I can.

Running the latest versions of software can be a little dangerous sometimes, as I was reminded. However you can send in the bug and crash reports. Eventually things will get fixed and the updated software becomes the stable version. Just be sure you have a second computer to use in case things don't work.

Wednesday, November 28, 2012

Helping with Homework

I was trying to get to bed early on Monday night because I had to catch a flight to the Bay Area the next morning. I was just climbing into bed when my son came in asking for some help with his girlfriend's school project. She needed to take a music file and cut it down from 4 minutes to 2. I have Audacity on my Linux machine in my office and knew it could perform the task without any issues. I reluctantly got out of bed and stumbled to my home office with son and his friend in tow.

I should have known it was not as easy a task as it sounded simply because teenagers never give you the entire truth. The first hurdle came when I plugged the thumb-drive into my computer and saw that the audio file was only 860 bytes long. Most MP3 files are in the order of 5,000,000 bytes in size, which is not a lot when you think about it. The 860 bytes told me that someone copied a link to the file instead of the actual file. Curse you Windows! At least the Mac is smart enough to know that when you drag and drop a link from the desktop to your thumb-drive, it copies the actual file, not just the link.

My next task was to locate an alternate source of the original music file. I could pay $0.99, but was really just trying to get this done as quickly as possible without spending any money. Besides, my son's girlfriend had already paid to use the song and it was the principle of the matter. So I downloaded the movie file from YouTube, striped out the audio portion, and then expanded the audio track to a .WAV file. Don't ask me about the steps I used as I didn't bother to write them all down. It wasn't a trivial task, but it wasn't too complex either.

Now I like my son's girlfriend even though she may think differently. However she really had no idea how to cut the music file down so that it was under 2 minutes long. She couldn't decide if she wanted the first 2 minutes, the last 2 minutes, or something in between. Naturally I ended up trying all 3, which takes up a lot of time as you have to listen to each segment all the way through to make sure you got the right stuff. The last 2 minutes was "yuckie" and the middle 2 minutes just didn't sound right. I just took the first 2 minutes and cut it at an appropriate spot. She ended up with 1 minute and 43 seconds of music that sounded good.

The final task was to burn the newly edited music onto a  CD. Who uses CD's any more? I tried a few different ways to create a music CD but none of them worked. After 30 minutes of frustration, my son's girlfriend asked if it was in a format she could just stick on her iPod. It was and so I gave her the file. I wish I had known that before wasting precious sleep time. Finally we were done and I could head off to bed.

I love my son but was a little irritated with this last-minute homework request. I was up an hour and a half later than intended simply to help one of his friends. Never mind that we had just come off Thanksgiving break where I had plenty of time to help with such projects. As I drifted off to sleep, I realized that even though the project was not for my son, it was important to him. Therefore it was important to me and worth giving up 90 minutes of my evening.

Thursday, October 28, 2010

The High Cost of Windows

Now that my son has a much larger hard disk on his MacBook, he can put more stuff on his computer. One of his classes at school requires a program that only runs on Windows. I suggested he pick up a copy of Parallels which will allow him to run Windows at the same time as MacOS X. The only problem is that he would also have to purchase a copy of Microsoft Windows.

In full disclosure, I gave up on Windows many years ago. When I buy a new computer that isn't a Mac, the first thing I do is repartition the disk so that a small portion is devoted to Windows and then install Linux on the rest of it. I find Windows to be slow, boated, buggy, and susceptible to malware. On my latest computer, I haven't even tried to boot into Windows and I have had the computer for over a year. When my son informed me that he needed a Windows program, I wanted to help him find the best way to get it running without screwing up the rest of his computer and that is why Parallels makes sense.

In the process of upgrading his hard disk, my son decided to buy a new copy of Mac OS X. It cost him $30 and was well worth the price. The latest version doesn't take up as much space as the previous version and also seems to run faster. As a full-time student, my son can get a copy of Parallels for $30, which isn't too expensive. Then came the shocker: the high price of Windows 7. Since my son doesn't have an existing license for a copy of Windows, it will cost him $199. If he wants to upgrade a copy from one of my machines where I don't use Windows, it will still cost him $119. I guess Microsoft has to pay a lot of money to all those people who think Windows 7 was their idea.

My son is a pretty smart kid and decided that $119 is just too much money and will opt to use the computer lab at school. Sure it isn't as convenient as working on his homework in his apartment, but $119 buys a lot of pizzas.

Thursday, May 6, 2010

Oops!

I know it may sound hard to believe, but yesterday I made a mistake. It wasn't a little mistake either. Then again, it wasn't a tragic mistake. I was working on one of the servers at the office and noticed we are keeping around a bunch of nightly database backups. I was cleaning them out and managed to delete every last one.

If I had been working on Windows or the Mac, restoring the files would have been as easy as going to the trash and pulling the ones I was trying to save. On Linux, a delete (or rm) really is a delete and it is nearly impossible to recover the removed files. Instead I will be forced to restore from a tape backup. That shouldn't be too much of a problem because the backup directory is copied to tape regularly and so the files still exist somewhere. It will just take a bit of work this morning.

I don't often make mistakes like this and will definitely be more careful with the "rm" command in the future. However my mistake now gives us a chance to make sure our backups really are working. If not, then I hope nobody ever needs to go back and look at what is in those old database files.

Tuesday, November 10, 2009

New Software Installation

On November 24th I will be taking the test to get my Ham radio license. While it is no longer required, I thought it would be fun to learn a little Morse code. I figure there have to be some software programs out there to help teach it. Then when I see someone use Morse code in a movie, I will be able to understand what they are saying. Perhaps it will match up with what the message is supposed to be or be an encoded message like, "these actors are morons."

I have three different types of computers that I use: Linux, Windows, and Mac. My Windows machine is at another desk in my office and I really don't use it much. Unfortunately most of the searches for Morse code tutorials turned up software for Windows machines. So I refined my search to look for tutorials on Linux. There were a bunch of them.

Normally you install software on the Red Had flavors of Linux using a program called "yum." If you want to install the QT user interface framework library, you simply run the following command:

yum install qt

The computer automatically finds the software on the Internet and automatically installs it. If you already have QT installed, it says, "it is already installed and is the latest version." You don't have to download anything nor do you have to answer very many questions related to the installation.

You'll notice that I used the word "Normally." Not all software for Linux is so easily installed. A lot of people write software for Linux but not everybody packages up their software so neatly. None of the Morse code tutorials were and that made my life a bit more difficult.

I downloaded the first tutorial. It was a bz2 tar file. What is a "bz2 tar file?" It is just a bunch of files packages into a single "tar" file and then compressed using the "bz2" algorithm. It is similar to a .ZIP file. I uncompressed and broke the files out so I could see what was included. There were some instructions on how to do the installation. I followed them only to get an error. It seems I was missing some important files. So I tried "yum" but it couldn't find them either. It was time to throw this tutorial away and try another one.

I downloaded the second tutorial. It had similar issues to the first one. There were a whole page of tutorials and so I had no problem throwing it away and moving down the list. The third tutorial said I just needed to run the program and didn't need to install anything. It lied. Once again I was missing some important file or library and it wouldn't run.

I was beginning to think that Windows may be the platform of choice for Morse code tutorials when I found a program called "morse." I downloaded it and was happy to see it run. I immediately figured out how to recognize the letters G, Z, and U. Once you master those, it adds one letter at a time until you have them all memorized.

Last night I could agree with Windows users thinking that Linux is just too difficult to use. It is rare that software doesn't install smoothly on Windows or Mac computers. Hopefully Linux developers will take note and make it easier to install their software.

Friday, November 6, 2009

Sneakernet

Yesterday I had both of the computers on my desk going at the same time and it was great. One of my computers has two monitors and so I hardly ever run out of screen real-estate making it a rarity that I actually need to use both computers. However yesterday was one of those unique times where I actually needed both machines.

My primary desktop is a Linux machine and is good for about 90% of the work I do. That other 10% is relegated to my MacBook laptop due to software being unavailable for Linux or for when I am traveling. Yesterday I was using Remote Desktop Connection on my Mac to work on a Windows machine located in San Francisco. I was putting together some documentation that required me to take some screen shots and include them in a technical paper. Since I like to do all of my image editing on Linux but word processing on the Mac, it required a lot of transferring of files.

To complicate things, My Mac was using Juniper Networks software to create a virtual private network (VPN) with the office in the Bay Area. Sometimes that means I can't access any of the computers in my home office without turning off the VPN. Since that slows things down a lot, I decided to resort to an tried and true method of networking: sneakernet.

Sneakernet is basically copying files to a removable medium and walking to the computer where you wish to copy that file. When sneakernet first got its name, people used floppy disks to transfer data. Now we use flash drives, CDs, or DVDs. If anyone ever needs to sneakernet data from here to Hawaii, I'm more than willing to be the one carrying the data.

Since my desktop and laptop are within easy reach of eachother, using sneakernet to transfer files didn't involve using my sneakers at all. I could copy from one computer to the other without even getting out of my chair. I transfered files all afternoon and was thinking I had an elegant solution and was rather smug. I didn't quite dislocate my shoulder patting myself on the back, but probably came close.

At the end of the day I decided to try a little experiment. I had been using sneakernet because I though the VPN would make it impossible for my Mac to see my Linux desktop. I thought I would give the network connection a try anyways. I assumed it was going to give me an error and wanted to know what that looked like in case anybody ever asked me, "What does this error mean?" Much to my surprise it actually worked. It turns out that both myself and the office in San Francisco had configured our networks in such a way that computer IP addresses remained unique.

My smugness quickly disappeared and I regretted not making the simple test earlier in the day. Now I know and can put away my sneakernet until the next time it is needed.

Wednesday, October 21, 2009

Linux Flavors

Yesterday my oldest son came into my office and started telling me how his day was. The topic of Red Hat Linux came up and he expressed a desire to have a copy. This started a whole discussion on the different flavors of Linux.

When I first installed Linux on one of my office machines over ten years ago, I went down to a local book store and bought a book about Linux. In the back of the book was a CD that came with a copy of the operating system. It was Slackware Linux and seemed to work just fine. I played around a bit but couldn't get the graphical user interface (GUI) working with my hardware. So I went to a computer store and bought a copy of Red Hat Linux. I think it was version 2. I was able to get the X windowing environment (Linux's GUI) running. Since then I have always been a fan of Red Hat Linux.

I purchased several more copies of Red Hat Linux before they decided to concentrate on becoming a server-centric operating system provider. Most of the work I do is for other people and they have their own servers. That means I don't really need a server-specific version of Linux. Not to worry, Red Hat created Fedora Core for people like me. It is freely downloadable from the Internet and so I don't have to get in my car and drive to the local computer store to get it.

About a year ago, one of my clients asked me to put together a staging server at my office. A staging server is used to test changes in software before they are moved into the production environment. This is very helpful if you want to upgrade your database software but need to ensure it will work before you make the change. Simply upgrade the staging server and run through a bunch of tests. Once you are satisfied the upgrade won't break anything, you can roll out the new database software to the production system.

My client is barely above water financially and so I wanted to save them a bit of money. The production servers run Red Hat Enterprise Linux Server but that costs about $2,500 per server (if I remember correctly . . . I just tried to look it up but you now have to purchase it from a reseller . . . what a pain). Since I really don't care about technical support for the staging server, I decided to load it with CentOS. CentOS basically looks like Red Hat Enterprise Linux but is free. That means if there are any problems you have to figure them out yourself. I wouldn't recommend it for a production environment unless you have one or two Linux experts on staff who are used to figuring things out for themselves. So far it has worked perfectly for my client's staging server. I told my son that if he really wants to give Red Hat Enterprise Linux a try, he should just use CentOS.

There are many different flavors of Linux and these only represent a handful of distributions available. I have a good friend who works for Cannonical who are the guys behind Ubuntu Linux. He keeps trying to get me to switch to his distribution. I am reluctant to do so because I am so familiar with what I am already using. Oh well, I would probably make a bad customer anyways because I try to avoid paying for anything.

Thursday, September 24, 2009

Linux Fixes Another Computer

One of my friends has been having computer problems and was about to go out and buy another computer. Rather than spending a lot of money, I had him bring the computer over so I could see if I couldn't fix the problem. Yesterday he dropped it off on the way to baseball practice when he briefly explained the issues he was having.

Windows XP wasn't recognizing the network card that was built into the computer. He went down to Best Buy where he talked with one of their "Geeks." He didn't have the computer with him and so the Geek asked several diagnostic questions. The conclusion was that the computer needed a new network card and so the Geek quickly found one for a really great price.

My friend brought the card home and installed it. He turned on the machine and installed the drivers for the new card. The new network card didn't work either. This means that the computer could not be used to browse the Internet which rendered it slightly more useful than a boat anchor (as a sailor, computers make really lousy boat anchors). So now it was my turn.

The first thing I did was go back to square one. I removed the new card the Geek had sold my friend and confirmed that Windows XP could not see the built-in network hardware. Then I put in the new card and went into the computer's BIOS to turn off the built-in network card. On his computer, it was as simple as hitting the "F1" key during the boot sequence and going to the "Advanced" menu option. Having two network cards in a computer is possible but sometimes they like to step on eachother's toes. It is advisable to have only one network card active when you are trying to debug problems like this.

Once again the network card was not recognized by Windows XP. This was a huge red flag. How do you know if the machine is bad when the the measuring device isn't working properly. In this case, the measuring device was the Windows XP operating system. I tried a simple experiment. I booted Linux from a CD. When you boot from a CD, it doesn't install anything on the hard drive and so you can test your machine's hardware without overwriting anything.

The CD takes a little bit longer than a hard drive to boot and so I went and got myself a sandwich while the computer thought about starting. Once it was up, I opened a browser window and could get to any number of websites just fine. This confirmed that it was Windows XP that needed help and not the hardware.

I told my friend that he had two options: He could reload Windows XP, which would probably fix everything, or he could install Linux. He picked up the machine this morning and will be installing Linux. I think that is a good decision.

Thursday, September 10, 2009

GIMP: A Free Photoshop Clone

Recently I was asked to provide an up-to-date family picture. Those that know me know that I hate taking family portraits. I prefer to get the family together on vacation or while we are skiing and have someone take a quick snapshot. Well it has been a while since we have all been together and I don't really have a recent picture of us. I am reminded of the scene in "Cheaper by the Dozen" where the father, played by Steve Martin, tells everyone that he will just Photoshop the absent oldest child into the family portrait they are about to take. The most recent portrait we have is missing our oldest daughter who is away at school and so I was hoping I could just Photoshop her into the picture.

The only problem is that Photoshop is a $700 piece of software. Luckily there is a free alternative called GIMP. It is available for Windows, Mac, and Linux. That covers about all home computing environments.

GIMP is an acronym that stands for GNU Image Manipulation Program. Seeing as "gimp" is a word that is generally a friendly yet derogatory term we use with one of our friends who has recently injured an arm or let, I would probably have used a different acronym. However that is is the name the program was given and it is anything but a handicapped tool.

One of the first uses you may have for GIMP is to remove that annoying "red eye" effect you get when taking a picture of someone using a flash. Simply go into the "filter" menu and under "enhance" is an option for red eye removal. Doing a quick scan of the other filters reveals a number of really cool effects that you can add to your photographs. Just be sure to always work on a copy instead of the original. We have one screwed-up family picture where we tried to remove our dog's "green eye" effect (people have red eyes but dogs have green eyes when their pictures are taken with a flash) and didn't save a copy of the original.

There are a lot of classes, books, and Internet tutorials devoted to Photoshop. A lot of this teaching material translates to GIMP because the two programs are so similar. However there are some differences and so you will want to see if there is a tutorial specifically built around GIMP first. One of my favorite GIMP-specific tutorials shows how to make really spectacular buttons to use on a website (one is shown below).



My oldest college-aged daughter was doing some work for me this summer and I taught her some basic GIMP tricks. At the end of her day, she would hang around on the computer after work to do some image editing for herself. She built complex animated graphics of ballerinas dancing around the screen as well as collages of all her friends. When I asked her what she thought of GIMP she told me that she had been searching for an image editing program and was glad I had showed it to her.

While it is fairly easy to steal yourself a copy of Photoshop and avoid paying that $700 price, it is still stealing. Since a free version of a comparable product exists there is no need to become a software pirate.

Wednesday, September 9, 2009

Two Heads are Better Than One

If you have seen the movie "Bill and Ted's Excellent Adventure" then you may recall one of the songs by Power Tool that declares "Two Heads are Better Than One." In computer lingo "Two Heads" refers to having two monitors on the same computer. Anyone who has plugged a projector or second monitor into a laptop knows that you have option of having the same (mirror) or different (dual heads) information on each screen. When running with dual heads it is nice to have that extra screen real estate.

When I got my first laptop, the display was only 640x480 pixels. The screen was usable while on an airplane but I was always eager to get to the office or back home where I had a larger monitor waiting. I never really used the dual head option because the laptop screen was just too small. It was like those worthless forarms on a T-rex.

Now technology has evolved to the point where laptop monitors can have resolutions greater than 1280x1024 pixels. My MacBook that I use for my laptop has a screen resolution of 1280x800 pixels. That is about the same as my previous desktop. There is no need to plug in a separate monitor to make the laptop usable. However a second monitor is nice to have when one is available.

When it came time to replace my desktop computer a few months ago, I decided that I wanted one that would support dual monitors. My personal brand recommendation for desktop PCs is Dell. They seem to be of sufficient quality and are reasonably priced. I went on their website and saw that some of their computers come with two monitor ports. That means you don't have to add a second video card (more money and complexity) to support dual heads. I priced out a machine with all of the options I wanted and wrote the information down. Then I went to the local Best Buy to see if they had one in-stock so I could look at it.

There is something to be said for retail locations where you can physically handle the merchandise before buying it. Unfortunately they didn't have the computer I had built on the Internet. They actually had a better model at a lower price. One problem with building your own machine is your knowledge is outdated. I know a lot about computers but I wasn't keeping up with the latest processors and options. Intel had come out with a new Processor that was faster and was in the latest Dell computer at Best Buy. It was on sale too. Since I was at Best Buy, I wasn't stuck with buying Dell Monitors which saved me even more money. In the end I saved myself about $400 between the computer and two monitors. The store also made sure I had all the cables I needed to connect everything (the extra monitor cables ended up being free).

Dell would have taken several weeks to build the computer and ship it to me. With Best Buy I had the computer immediately and was able to bring it home.

The first order of business was cleaning off my desk. It was set up for one 17-inch LCD display. My new computer has two 23-inch displays and I needed to make room for them. It also took some work positioning them so I could use the computer but still be able to have room for my laptop and be able to watch TV at the same time. It took some rearranging but I was able to make it work.

Once the hardware was set up, it was time to get the software working. I booted the machine into Windows and got Vista going without any trouble. I shut down the machine, rebooted with a disk partitioning CD, and moved things around on the hard drive so I could make room for Linux. Then I loaded up Linux and configured it to recognize the second monitor as a separate display. By default Linux thinks the second monitor is a mirror of the first. It is an easy configuration change.

Now I have two monitors on my primary desktop computer and it is a huge improvement over my old system. I can keep my e-mail open on one monitor and then do all my work in the other. When a new e-mail arrives, I simply drag my mouse and the cursor jumps from the right edge of one monitor to the left edge of the other. Now I just need to stop trying to use my desktop mouse on my laptop screen because that doesn't work.