alvin's blog

vi commands - the most common vi navigational commands

There are a lot of commands for navigating through a file with the vi editor (or, more recently, the vim editor), but the reality is that I've used various forms of Unix (Ultrix, AIX, CLIX, SCO Unix, etc.), Linux, and more recently Mac OS X, and there are only a few vi commands that I use for moving around in a file.

So I thought I'd list those here, the most common vi commands.

JFormDesigner - How to create a ButtonGroup

I just learned how to create a ButtonGroup using JFormDesigner, and it's pretty easy and pretty cool.

First, add all the related buttons you want on your JFormDesigner form. Next, click all the buttons while holding down the [Control] or [Apple] key, depending on your platform, so the all the buttons are selected at one time. Then right-click one of the buttons, then select the "Group Buttons" option from the popup menu.

JFormDesigner - how to set the column width of a JTable

I just noticed that you can set the preferred size of a column in a JTable using JFormDesigner. If you're looking at a JTable in the normal JFormDesigner view, click the ellipsis button for the model property in the Properties list. This brings up the JTable model editor.

Next, click a cell in the column you want to modify. Then on the bottom-right of this dialog you'll see a few fields labeled "Pref. Width", "Min. Width", and "Max. Width". Just type in a value you want for the preferred width of your column.

AppleScript time example - current time as hours and minutes

AppleScript time subroutine FAQ: Can you share an example of an AppleScript subroutine (function) that returns te current time?

Here's an example AppleScript subroutine (also known as a function or method) that returns the current time as hours and minutes, along with the AM/PM modifier. For the purposes of creating an alarm clock AppleScript program, I didn't like the default format of the AppleScript current date command, so I use this method to extract the current time information I want.

AppleScript result output - How to display output in the ScriptEditor Result tab

AppleScript result output FAQ: How can I display the output of my AppleScript script (the AppleScript result)?

Cool, I just learned how to get AppleScript output to show up in the ScriptEditor Result tab. In short, just leave a string at the end of your AppleScript script, and it is printed in the ScriptEditor Result tab.

ScriptEditor Result output: An AppleScript output "Hello world" example

Here's a quick AppleScript result example that puts "Hello world" in the ScriptEditor Result tab:

AppleScript dialog lists - how to display a list in a dialog

AppleScript dialog list FAQ: How can I display a list in an AppleScript dialog?

I couldn't find an example showing how to display a list of strings in an AppleScript dialog, so I created the following simple example. First I create a list (in this case a short list of voices on Mac OS/X that can be used with the say command), and then I display the list in a dialog the user can use to select one of the items in the list.

Syndicate content