drop

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.

MySQL drop table and foreign keys tip - the FOREIGN_KEY_CHECKS variable

MySQL “DROP TABLE” FAQ: Help, my MySQL database tables have a lot of foreign keys, and as a result it's a pain to use the MySQL DROP TABLE command in my scripts; they keep failing because of all the foreign keys. Is there something I can do to work around this DROP TABLE foreign keys problem?

Copy files on Mac OS X using drag-and-drop

Mac drag and drop FAQ: How do I copy files on a Mac OS X system using drag and drop between one or more Mac Finder windows?

It turns out that when you drag and drop a file between two Finder windows on the same Mac OS X filesystem you end up moving the file. Unfortunately that's not usually what I want to do; usually I want to copy the file, which recently begged the question "How do I copy files when using drag and drop?"