June 2005 Archives

I've found Cygwin to be the best method for setting up an SSH server on Windows. This is partly due to the need for Cygwin for other purposes (rsync, cron, shell scripts, etc).

To set it up, first install Cygwin, including the OpenSSH package. Then run the ssh host setup command.

ssh-host-config

This command should result in several prompts. Answer yes, yes, yes. To each question. Then use ntsec tty for the CYGWIN= variable.

After the installation script completes, you can start the sshd daemon with the Windows net command.

net start sshd

Your /etc/passwd file can sometimes become disorderly as users come and go on a system. This simple script displays the file sorted numerically by the uid field.

sort -t : -k 3,4 -g /etc/passwd

The -t option identifies the field separator. In this case we use the colon (:). The -k 3,4 option determines the order in which fields will be compared for the sort. We're sorting by the 3rd field (UID) followed by the 4th field (GID). Lastly, the -g option means we want the sort to occur numerically. This makes the number 56 appear after 9. Using the default (ASCII) sort places 56 before 9 (5 comes before 9).

This variation sorts the group file by the group id (GID) field.

sort -t : -k 3 -g /etc/group

Consider an example web application that manages a database relationship between Movie Studios and Films. Each movie studio has n active films. Updated information on Films arrives in batches (box office numbers, ticket sales, etc). Searching, selecting and editing Films one at a time is inefficient, so the client has requested a "batch editor" interface.

It's relatively trivial to modify the way dates are formatted when they are bound to form fields with Spring. Just implement the initBinder method in your controller. Here's an example.

protected void initBinder(HttpServletRequest request,
                          ServletRequestDataBinder binder)
  throws Exception
{
  super.initBinder(request, binder);
  binder.registerCustomEditor(Date.class,
    "estimatedCompletionDate",
    new CustomDateEditor(new SimpleDateFormat( "M/d/yy"), true)
  );
}

Who's this guy?

Aaron Longwell is Chief Web Craftsman at New Media Logic Corporation in Coeur d' Alene, Idaho. As a professional software developer for 12 years and a student of public policy, he occasionally has interesting things to say about software, technology, culture and politics.

Subscribe to feed Subscribe to my RSS Feed

  • View Aaron Longwell's profile on LinkedIn
  • Recommend Me