next

How to use iterators with Scala collections classes

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 10.12, “Using Iterators with Scala Collection Classes”

Problem

You want (or need) to work with an iterator in a Scala application.

Perl next operator - for loop and if statement examples

Perl next loop FAQ: Can you demonstrate how to use the Perl next operator in a for loop?

Problem: You're writing code for a Perl loop, and you need to write some logic to skip over the current element in the loop, and move on to the next loop element.

Perl loop - how to break out of a loop in Perl

Perl loop break FAQ: How do I break out of a Perl loop?

Problem: You're writing some Perl loop code (for, foreach, or while), and you have a condition where you need to break out of your loop early, and you quickly find out that Perl doesn't have a 'break' operator.

The Perl "break" statement

In many programming languages you use the break operator to break out of a loop like this, but in Perl you use the last operator to break out of a loop, like this:

How to control iTunes from the keyboard on Mac OS X

iTunes Question: Is there a way to control iTunes from the keyboard when using Mac OS X?

Answer: Yes, there is a nice (and free) little program named Sizzling Keys that lets you control iTunes even when iTunes is minimized, hidden, or being displayed in another Space in the Mac OS X operating system. Just download and install Sizzling Keys, and select the key combinations you want to use to control iTunes.

Common vi/vim navigation commands

Here's a quick list of the most common vi and vim editor navigation commands I use every day.

Moving on the current line

Here are the most common navigation commands for moving around the current line:

How to exclude certain elements in an array with pattern matching

Problem: You have an array of elements, and you need to process every element in the array, except the elements that match a given regular expression (pattern).

Solution: You can solve this problem using a combination of the Perl regular expression pattern matching, along with the next operator.