How to package Scala code with the “curly braces” style

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 7.1, “How to package Scala code with the 'curly braces' style.”


You want to use a nested style package notation, similar to the namespace notation in C++ and C#.


Wrap one or more classes in a set of curly braces with a package name, as shown in this example:

How to control Scala method scope with private, package, and more

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 5.1, “How to control method scope in Scala (private, package, more).”

Back to top


Scala methods are public by default, and you want to control their scope in ways similar to Java.

Back to top


Scala lets you control method visibility in a more granular and powerful way than Java. In order from “most restrictive” to “most open,” Scala provides these scope options:

Table of Contents

  1. Problem
  2. Solution
Back to top

How to create inner classes in Scala

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 4.16, “How to create inner classes in Scala.”


You want to create a Scala class as an inner class to help keep the class out of your public API, or to otherwise encapsulate your code.


Declare one class inside another class. In the following example, a case class named Thing is declared inside of a class named PandorasBox:

Scala - Importing Java classes and packages (import syntax, examples)

Summary: Scala import syntax examples.

I was just trying to develop a little Java/Swing application in Scala, and right away I ran into the problem of how to import Java classes and packages into a Scala application. 

In short, the following code shows how to import a Java class into a Scala application:

Is there a package manager for PHP? alvin April 12, 2009 - 6:53pm

PHP FAQ: Is there a package manager for PHP?

Answer: Yes, PEAR (the PHP Extension and Application Repository) is what you need. As the website describes it, "PEAR is a framework and distribution system for reusable PHP components."

Here's an example of how I used PEAR to install the HTTP_Request library, showing both what I typed, and the output from PEAR as it performed the installation.

A shell script to search multiple jar files for a Java class or pattern

I've found that there are several times when I need to be able to find a Java class inside of a jar file. Usually this happens when something isn't working, and I get something like a Java ClassNotFoundException. In the process of debugging this problem -- especially if I'm using a jar library that I haven't used before -- I list the contents of one or more jar files to debug the problem.

Linux yum command man page alvin October 8, 2007 - 8:00pm

This is the "man" page for the Linux yum command, copied here for a CentOS Linux system.

Mac Java application - how to bundle a Java application on Mac OS X

I just posted a new tutorial titled How to bundle a Mac Java application on Mac OS X using Xcode's Jar Bundler. This tutorial demonstrates how to use the Mac OS X Jar Bundler utility to configure a Java application to install like a native Mac application, and look right in the Finder, the Dock, and the Get Info window. It also starts to look at using an Ant task to automate the bundling process.


Mon, July 26, 2004 (New LaTeX tips)

I've created several new LaTeX tips in the last 12 hours and posted them in my LaTeX blog area. This includes tips/tutorials/examples on how to create your own commands; how to use the "html" package; and how to use the "versions" package.