drop

Scala Vector filtering methods (examples)

This page contains a collection of examples of filtering methods that can be used with a Scala Vector class. I’ll first show a table that describes the filtering methods, and then show examples of them.

How to extract a substring near the Nth occurrence of a string or character in a string

A Scala substring example: I ran into a situation today where I wanted to get a string after the Nth occurrence of another string, in this case after the 6th occurrence of a “:” character. There are probably many ways to determine the Nth occurrence of a string in another string, but as a quick example, this is what I did.

First, I started with this string:

How to drop the first matching element in a Scala sequence

Summary: This blog post shows one way to drop/filter the first matching element from a Scala sequence (Seq, List, Vector, Array, etc.). I don’t claim that the algorithm is efficient, but it does work.

Background

While creating some Scala test code earlier today I had an immutable list of toppings for a pizza, and I got into a situation where I wanted to remove the first instance of a topping.

Mac OS X image scaling - Create your own fast, free image scaling app

Mac OS X images FAQ: Can you recommend a small Mac app that scales Mac images fast, and is preferably free?

I've been creating a lot of scaled images for my One Man's Alaska website lately, and since I always scale them to a width of 600 pixels I've been trying to find the fastest, easiest way to create these scaled images.

I have been using the Gimp to do this, but it's really a little cumbersome and overkill for this. Another app named EasyCrop is closer to what I want, but it has a number of drawbacks as well.

How to copy files on Mac OS X

Mac "file copy" FAQ: How do I copy files on my Mac?

When people move from Windows to Mac OS X, a common question is "How do I copy files on my Mac?" I hope this short Mac file copying tutorial will help answer that question.

How to bookmark a directory in the Mac Finder (Part 2)

A very important warning: When you drag your folder over to the PLACES section of the Finder, make sure your image looks like the image shown above, where the folder is clearly going to be placed between two existing folders. If you drag your folder over to the left side, and you're highlighting another folder in the PLACES section, you're going to end up moving your folder to that other folder. That's a great technique for moving your folder from one place to another, but it's not what I'm trying to describe here.

Creating Mac Finder bookmarks (Part 1)

One of the cool things about the Mac Finder is that you can create shortcuts, or bookmarks, to folders that you visit frequently. This is cool, because instead of clicking around to get to your commonly used directories, you can get to them with just one mouse click. That's as fast I can think to make it.

Java: How to handle drop events to your Mac OS X Dock icon (Part 2)

In Part 1 of this tutorial I shared the Java source code you need to handle drag and drop events on Mac OS X. But as I mentioned in that tutorial, the recipe to handle files that are dropped onto your Dock application icon requires a little more work, in particular an Ant build process that uses the JarBundler task. So here in Part 2 of this tutorial, I'm sharing my Ant build script that completes this recipe.

Mac Java - Image drag and drop

Java Swing drag and drop FAQ: How do I get Java/Swing image drag and drop working on Mac OS X?

I've been working on several new Swing applications for Mac OS X recently, and most of these applications include features like image processing, copy and paste clipboard interaction, and in today's example, dealing with drag and drop events on the Mac.