Scala, Java, Unix, MacOS tutorials (page 368)

Mac CAF/AIF/MP3 sound file FAQ: How do I convert a CAF file to AIF format, MP3 format, or any other sound file format on Mac OS X, for free?

Convert CAF to AIF, MP3, WAV, for free - solution

While writing my Mac "Hide Your Desktop" application, I can't work with certain sound file formats yet, so I've been digging around trying to figure out how to convert Apple's "CAF" file format into a format I can deal with, and I really need files to be in an AIF, MP3, WAV, or AU format.

Last night I found a cool Mac OS X command-line utility named afconvert that lets you convert sound files from one format to another, for free. So I dug into it, and eventually created a shell script that lets me convert all my CAF sound files into AIF sound files. A slightly modified version of the same script will allow you to convert CAF or AIF sound files to MP3, WAV, and other sound file formats.

Just a quick note today that in creating my "Hide Your Desktop" application, I don't know if I would have gotten through all the PayPal "Instant Payment Notification" (IPN) integration work without great articles like this one from opcoders.com.

While that article is a little terse in spots, it's also very helpful, in particular in guiding you through the maze that is PayPal. So, many thanks to Simon Strandgaard for those PayPal IPN notes.

Today's announcement that Google is buying BumpTop continues the string of Google and Apple buying up technology companies so fast you'd think they were, well, Microsoft, at least "Microsoft back in the day".

I'm reminded that ~10 years ago Bill Gates said about Sun Microsystems (and I'm paraphrasing here):

"Sun is dead, they just don't know it yet. Their business model consists of selling overpriced servers, and sooner or later the market will realize that."

Having watch RISC processors lose their speed advantage -- and then switching to Linux as a result -- I agreed with that assessment, and in 2009 it finally came to fruition as Sun was bought by Oracle.

Which leads to the question: If Bill Gates could look at it objectively, would he say the same thing now about Microsoft?

As the Arizona Immigration Law continues to make big news here in the United States, I decided to read the United State Constitution for the first time in thirty years.

As someone who has written dozens of software requirement specifications, the first thing that jumps out at me is that the U.S. Constitution would have never been approved as a requirements specification on my projects. Terms like "people", "person", "tranquility", and "unreasonable" are so vague that from a software decision-making process, they are useless.

All I can imagine at the moment is going up to Mr. Washington and Mr. Jefferson, and saying:

"Excuse me gentlemen, I'm working on the security model for our web app, and I'm wondering if you can clarify a few terms for me?"

<< Back to "Java exec with ProcessBuilder and Process, part 2"

Our ThreadedStreamHandler class

Based on an old-but-good article at JavaWorld, I'm developing the following Java ThreadedStreamHandler class. (It's still a work-in-progress, but as mentioned, commands that don't have to be run using sudo seem to work just fine right now.)

Did Gene Roddenberry and other Star Trek designers create iPad-like devices many years ago? No need to say much here, just check out all these "Star Trek iPad" images, and see what you think. First, the iPad as seen by Star Trek - Next Generation designers:

Star Trek iPad device 2

Hmm, no keyboard in that first one. Must have used multi-touch.

No keyboard here either:

I started laughing when I saw this picture on ESPN this morning. The Celtics player #11 suddenly breaks out into a dance while everyone else is playing an NBA playoff basketball game behind him:

Celtics #11 breaks out into a dance during playoff game with Heat.

The song "Y - M - C - A" suddenly comes to mind, lol.

After taking a recent look at a Java decompiler, I decided to look again at the Java obfuscator market. I was going to put together a little list of Java obfuscators, but the people at ProGuard have already done that work for me.

So, here's a link to their list of Java obfuscators, which includes a simple tabular comparison of each obfuscator.

An interesting situation has come up where I suddenly have $600 coming to me in "found money". (It's not an IRS tax refund, but a similar "found money" situation.) Rather than just chuck it into the bank, I've been thinking about what to do with it. Get an iPad? An Android phone? A Kindle? Or since I don't currently own a tv, maybe a nice 32" flat panel?

Here's a quick line of Java code that takes a given input string, strips all the characters from that string other than lowercase and uppercase letters, and returns whatever is left:

Java properties FAQ: In Java, how do I determine a user’s home directory?

Answer: I often need to do this when creating Java/Swing GUI applications. Fortunately it's simple (once you know how to do it), just use a line of code like this, using the Java System class getProperty method:

String homeDir = System.getProperty("user.home");

On my Mac OS X system, the String homeDir now contains the following content:

Java on Mac OS X Swing FAQ: I've written a Java/Swing application, and bundled it so it looks like a native Mac OS X application. When I run my application, if I am writing to System.out or System.err, where does this output go?

Wow -- I just looked at the state of the "Java obfuscator" market, and all I can say is, well, wow. If you've written some Java code as commercial software (where you don't want your Java class files turned back into Java source files), and you haven't obfuscated that code, it looks like a Java obfuscator can turn your Java class files back into source code very easily (once again).

PHP email FAQ: How do I send email from a PHP script? (Including sending email with an attachment.)

Continuing with my initiation into the PHP programming world, I just finished developing a PHP script to send a mail message with an arbitrary attachment. (I write 'arbitrary' there because a lot of the example PHP mail scripts I've seen focus on attaching an image, and I'm not really familiar with MIME types yet, and "image/jpg" wasn't working for my needs.)

Too funny, I just realized I own the devdaily.net domain, so I just posted a goofy website created with iWeb out there, just so there would be something there besides a blank page.

Here's a link to the main devdaily.net web page, and here's a link to the devdaily.net blog, which may or may not contain random thoughts from moi from time to time. Oh, and sorry about those ad banners at the top, that's what you get with "free hosting", lol.

 

 

Very cool, in September, 2010, the "handsome android" is scheduled to join the crew of the International Space Station.

Here's a link to the story on popsci.com, including a little video of the android/robot in action. And here's a second link to more background information on the "handsome android", aka, Robonaut2.

PHP string FAQ: How can I strip unwanted characters from a PHP string? (Also asked as, How can I delete unwanted characters from a PHP string?)

Solution

Here’s a quick PHP preg_replace example that takes a given input string, and strips all the characters from the string other than letters (the lowercase letters "a-z", and the uppercase letters "A-Z"):

 

Summary: Using True License as a Java license key manager.

I'm currently working on a plan to release four small software applications this year, and I'm going to try my hand at licensing them as shareware applications, written in Java. After digging around for a "Java license manager", I finally found a free, open source product named "True License" that I like, and I'm giving it a try.

If you're looking for a PayPal IPN example written in PHP, I believe the following code works okay. It's based on the PayPal PHP IPN example (from the PayPal developer site), but I fixed some bugs from their example, added an alternate PHP socket example so you don't have to use SSL to connect to PayPal, and added more variables to the script.

Too funny ... Apple rejects Mark Fiore's iPhone application "because it included cartoons that ridiculed public figures." Fiore then wins the Pulitzer Prize, and mentions the next day that his iPhone app was rejected.

Immediately Apple "encourages" Mr. Fiore to re-submit his app for consideration in the App Store. (Do you think Apple will "approve" him now?)

Here are some more notes from the New York Times article where I just read about this: