Scala, Java, Unix, MacOS tutorials (page 380)

Here's the source code for a Perl CGI textfield example (a Perl form example). The Perl code below shows how you can display an HTML form with a textfield using the Perl CGI.pm module.

The first time this script is called it displays a textfield in a form. After you submit the form, this script displays the text that you entered in the textfield.

Here's the source code for this CGI.pm "Perl form" textfield example script:

vi (vim) line navigation FAQ: What is the vi command to move to the end of the current line? (How do I move to the end of the current line in vim?)

Short answer: When in vi/vim command mode, use the "$" character to move to the end of the current line.

Other vi/vim line related commands

While I'm in the vi line neighborhood, here's a longer answer, with a list of "vi/vim go to line" commands:

I know the vi editor (and vim editor) can be a little hard to get started with, so I've been trying to share some short vi tutorials lately. Today I'd like to share some simple vi insert commands.

vi insert commands - reference

If you're already comfortable with the vi editor and just need to know some commands to insert in vi, here are the vi insert commands I use every day:

vi/vim editor FAQ: Can you share some example vi/vim delete commands?

The vi editor can be just a little difficult to get started with, so I thought I’d share some more vi commands here today, specifically some commands about how to delete text in vi/vim.

vi/vim delete commands - reference

A lot of times all people need is a quick reference, so I’ll start with a quick reference of vi/vim delete commands:

vim copy and paste FAQ: How do I copy and paste in vim (the vi or vim editor)?

In this short vi/vim tutorial I thought I'd share the most common vim copy and paste commands I use on a daily basis. I've been using vi (and vim) for almost 20 years now (wow), and these are the most common copy/paste commands I use.

[toc hidden:1]

Perl MySQL FAQ: Can you share a Perl MySQL example? (Or, can you share a Perl DBI/DBH MySQL example?)

I don't know if this Perl DBI DBH MySQL example code will help anyone, but I thought I'd put it out here in hopes that someone will gain something from it.

Java date/time FAQ: When working with the Timestamp class, how do I create a “Java current timestamp”? For instance, how do I create a JDBC Timestamp object to represent the “current time” (“now”)?

Solution

You can create a “current time” JDBC Timestamp in just a few lines of code, using the Java Calendar class and a java.util.Date instance, as shown in this example code:

[toc hidden:1]

Linux FAQ: How do I show Linux disk space information? (Also stated as, "What is the Linux disk space command?")

Answer: You show Linux disk space information with the Linux df command. I have a more detailed Linux df command example, but in short, I typically use the Linux df command like this, with the -h option:

df -h

The -h option stands for "human readable", and I almost always use that option instead of using the df command by itself.

Java Date class "addition" FAQ: Can you show me how to add various times increments to a Java Date object?

I've been doing a lot of work with the Date class in Java lately (both java.util.Date and java.sql.Date), and before leaving this area for a while, I thought I'd put together some "Java Date add" examples that demonstrate various "date add" and "calendar add" techniques, including how to get the date and time one hour from now, tomorrow's date, next week, next month, and next year.

Here's a quick post to help anyone that needs a quick Driver and URL reference when using DB2 with Java and JDBC.

If all you need is a reference to the DB2 JDBC Driver and URL connection string syntax, this basic information should work:

Here's a quick post to help anyone that needs a quick JDBC Driver and URL reference when using Microsoft SQL Server with Java and JDBC.

The basic SQL Server JDBC Driver and URL information you need is shown here:

Java MySQL Driver FAQ: Can you share a Java/MySQL JDBC Driver and URL example, i.e., how to connect to MySQL in Java?

Sure. Here's a quick post to help anyone that needs a quick MySQL JDBC Driver and URL reference.

The basic MySQL JDBC Driver and Java MySQL URL information you need is shown here:

Here's a quick post to help anyone that needs a quick JDBC Driver and URL reference when using Postgresql (Postgres) with Java (and JDBC).

The basic Postgresql JDBC Driver and URL information you need is shown here:

On this blog I've shown a variety of ways using Java to open a URL connection, and then read data from that connection, including my "How to open and read from a URL with the Java URL and URLConnection classes" tutorial. In this example I'll show how to open a URL using the Java HttpURLConnection class.

I couldn't sleep last night so I started reading Edward Tufte's "The Visual Display of Quantitative Information", and I started thinking about software project metrics that might be useful to the team members on a software development project (including developers, business analysts, domain experts, and stakeholders), and how I would show these metrics in simple but data-filled Tufte charts and graphs.

My Java sound/audio example: I'm working on a simple "meditation" application that plays a sound after a certain period of time (the sound of a gong), so I thought I'd share some source code out here that demonstrates how to play a sound file in a Java application like this.

(Note: I initially found this technique described at JavaWorld.com, but the code below is taken from my project.)

In this case the sound file I'm going to play is an "au" file, but I believe this same technique works with most other sound file types as well.

I thought I'd share a collection of JOptionPane showInputDialog examples today. I'll start with the easiest example first, then try to add a little complexity as we go along.

First up, here's a simple JOptionPane showInputDialog example where I display a dialog that prompts a user to enter their name:

I'm finally catching up on the latest tablet hype. Here's a link to the Microsoft Courier video on the Gizmodo tablet device, and a second link to the Apple tablet device that Gizmodo says is going to "redefine newspapers, textbooks, and magazines."

Last night I ran across a software requirements specification that I meant to share out here a long time ago, but unfortunately I never did. I created this software requirements specification for one of my customers, and they kindly gave me permission to publish this document out here (after I took out a few things specific to their business).

Over the last three days I've created a new Java Swing application for the Mac OS X platform, and today I'm giving away all the source code for this project (free of charge). The complete project includes both (a) all the Java source code and (b) all of the Ant build script code needed to build this application. The end result of the build is what appears to the end user to be a native Mac OS X application.