An Android AlertDialog Builder example

An Android AlertDialog Builder example:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Exception!").setMessage(t.toString()).setPositiveButton("OK", null).show();

Basic Android ‘Toast’ syntax examples

Android Toast FAQ: How do I create a Toast message in Android? (Or, Can you share some Android Toast message syntax examples?)

Here's one example of the Android Toast syntax:

Toast.makeText(ProjectActivity.this, "Your message here" , Toast.LENGTH_SHORT).show();

and here's a second example, this time referring to the Android application context as the first method parameter:

Scala, IMAP, SearchTerm, AndTerm, FromStringTerm, SentDateTerm, FlagTerm, and FetchProfile

If you're looking for a simple Scala IMAP client tutorial/example, please follow that link, but if you're interested in some Scala source code that demonstrates IMAP searching with Scala, JavaMail, SearchTerm, AndTerm, FromStringTerm, SentDateTerm, FlagTerm, and FetchProfile, this source code may be for you.

In short, here's what the following Scala IMAP client does:

A CakePHP jQuery fade out flash success message

CakePHP flash fade out success messages: If you'd like to show fade out success messages in your CakePHP applications using jQuery, like the ones currently used by applications such as Twitter and Facebook, I thought I'd share the formula I came up with this weekend. While it includes touching a few different files, it's pretty easy, and once you've done the basic setup work you can display CakePHP fade out success messages in all of your web pages, and web applications.

iPhone "Slide for Emergency" and "Activated" error messages

I'm not sure what I keep doing, but every once in a while when I turn on my iPhone 3G (after turning it off completely, i.e., a restart/reboot) I see a couple of different weird "error" messages. The first error message says, "Slide for emergency", and looks like this:

Ruby NameError: uninitialized constant error message

Problem: When working with some Ruby code in an irb session, I just got the following error message:

NameError: uninitialized constant Tempfile

Here's a snippet of my irb session where this error occurred:

>> tmp =
NameError: uninitialized constant Tempfile
	from (irb):1


This "NameError: uninitialized constant" looks intimidating, but it's actually not a big deal: I just forgot to require the tempfile package.

The PHP "headers already sent" error message

Still in my early days working with PHP, I've learned that it's really easy to generate the dreaded "headers already sent" error message. If for some reason you actually want to generate this error message intentionally, I've learned that all you have to do is try to send HTML body content (any non-header content) before calling the header() or setcookie() methods, and you'll get that PHP error message right away.

iPhone email photo tip - how to save an image you receive as an email message attachment

iPhone email photo/image tip: If you receive a photo/image as an attachment in an email message while using your iPhone you can save that image to your iPhone photo collection very easily. Just press the image with one finger and hold it down for a second or two, and a menu will slide up from the bottom asking if you want to save the image.

I use the iPhone Mail program as an interface to my Yahoo email account, and a friend just sent me an email message with three image attachments. By pressing and holding one of the images, a menu popped up with three options: