Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

Looking at file contents with the "more" and "cat" commands

If I want to be sure that I have the right file I can also look at it with the more command, like this:

Question: How do I set my Java/Swing application to use the native look and feel of the platform it is running on?

Answer: Use the Java UIManager class to set the look and feel properly, like this:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Note that the setLookAndFeel method can throw an UnsupportedLookAndFeelException exception that you should handle.

 

Mac Java menubar FAQ: I'm creating a "Mac Java" application for (a Java Swing application for Mac OS X) ... how do I put my Java menu bar (JMenuBar) on the Mac menubar?

Answer: In your Java Mac application, set the system property apple.laf.useScreenMenuBar to true, like this:

Here's a simple Ruby program that opens a text file, then uses a series of simple algorithms to look for hidden words in the text. For instance, it looks at only odd words, only even words, then looks at Nth characters, Nth words, and also Fibonacci words and characters.

Logging in to a remote system

To login to that system I'll use a command named ssh, which stands for "secure shell". It's basically an encrypted login session to a remote system. To login to that remote system I'll type this command in my terminal window:

ssh al@foo.bar.com

(Of course everything after the ssh command there is made up. I don't have a login account on any systems named anything like that.)

This article is now part of my new eBook, which is only $2.99 on Amazon.com:

You want me to do what? A Survival Guide for New Consultants

I hope you enjoy my book, and more than that, I hope it helps you have a very profitable and rewarding career.

 

Quick Start: A typical login session

In my previous post I talked about the history of the Unix and Linux operating systems to give you a little background for the rest of this lesson.

Next, I'd like to dig in and show you what a typical Unix login session looks like, and then I'll get into more details after that.

I thought I'd take a little time and write a tutorial on how to get started with the Linux, Unix, and Mac OS X operating systems. As I write this I'm trying to keep in mind a friend of mine who works strictly on Windows, so I'm writing this from that perspective.

Here then is my "Getting Started with Linux and Unix" tutorial.

I just updated my "Software career best practices 101" post from a few years back. It was a little dated, and hopefully now it's a little refreshed.

I just updated an old Postgresql blog entry about how to make a backup of a Postgresql database. The syntax changed quite a bit since that post in 2004.

I thought I'd take a few minutes to look at the philosophical design differences between the Mac OS X user interface and the Microsoft Windows user interface. This topic is probably worthy of a Master's degree thesis, but I'm going to rattle off the big differences I see in about 30 minutes worth of typing.

Ever have one of those days when you wish you hadn't said something publicly? Kevin Miller must certainly be feeling that way these days:

After working with del.icio.us and other tag-based systems, and thinking about adding tag support and other features to this blog, I started wondering if anyone had applied the "tag" concept to any other systems that are typically directory-based (as del.icio.us seems like a very good replacement for a traditional hierarchical organization (directory) of bookmarks).

Mac HTML editor review: I didn't go exactly where I wanted with that last post about Mac WYSIWYG HTML editors, so let me try again. This time I'll go the product review route I initially planned to go in that last post.

Mac HTML editors

First, as I related in that post I'm not happy with any of the Mac HTML editors I've found. Second, the point I didn't make, is that these are the Mac HTML editors I've looked at so far:

My search for a Mac WYSIWYG HTML editor continues ... I just finished trying Coda, but I don't like it much more than I like using a text editor like TextMate.

I understand the need for these HTML/text-editing tools when you get down to the nitty-gritty details of HTML editing and you want to work only with the HTML source code, and Coda or TextMate on the Mac are good for that.

Linux find/grep FAQ: How can I combine the Linux find and grep commands to search a large collection of files?

A lot of times when I need to find a file I know the text in the file that I'm looking for, but I can't remember the filename, or can't think of what directory it might be in, other than somewhere below my home directory. When this happens, and other search means like the "locate" command don't help, my favorite way of searching for text strings in files that are spread through a bunch of directories and sub-directories is this:

I thought I'd share the source code for my Java email address validator class. I'm not sure if there's a big need for it ... I wrote it a long time ago, and I think I created it because Java's javax.mail.internet.InternetAddress class wasn't validating email addresses as deeply as I wanted it to. For instance, I think it would allow the string "fred" to be a valid email address, but on the internet you really want to see something like "fred@foo.bar". So I think that's where this class comes from.

Here's the source code for a simple "Java send mail" class that can simplify the process of sending email messages from Java applications. I've named this class MailAgent, and I'm sharing the source code here for free. I've included a brief usage statement in the Javadoc at the top of the class. Hopefully it's all pretty straightforward, and a decent example of using the JavaMail API to send an email message.

It’s raining in downtown Alaska today, so I went ahead and created a vi editor “cheat sheet” for vi and vim users. I tried to focus on the basic vi/vim commands I use most often.

Here’s a direct link to my vi/vim editor cheat sheet (in PDF format).

 

I created a "cheat sheet" of commands (including examples) for Unix, Linux, and Mac OS X users. You can download the PDF for free from my Unix education page.