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

iPhone 'user agent' FAQ: I'm trying to optimize my HTML/web app for the iPhone; how do I detect an iPhone, iPod, or iPad browser in my web application?

This Apple page shows the iPhone, iPod, and iPad user agent strings, so you just need to write some JavaScript that properly parses those iPhone/iPad browser user agent strings.

iPhone HTML web app style sheets FAQ: I'm trying to optimize my HTML/web app for the iPhone, how do I specify a style sheet to be used for just the iPhone?

There are several different approaches you can take, but with CSS3 the most direct approach you can take is to add an expression to your iPhone CSS link tag, as shown here:

iPhone HTML apps startup image FAQ: How do I set the startup image (splash screen) for my iPad or iPhone HTML app?

This quick blurb from the Apple developer documentation leads us to the answer:

On iOS, similar to native applications, you can specify a startup image that is displayed while your web application launches. This is especially useful when your web application is offline.

By default, a screenshot of the web application the last time it was launched is used. To set another startup image, add a "link" element to the webpage.

iPhone HTML app icon FAQ: I'm creating an iPhone HTML web app, and I want users to be able to save my HTML app icon to their iPhone home screen; how can I add a custom iPhone app icon to my web application?

The iPhone Mobile Safari web browser recognizes a special HTML tag that lets you add an iPhone app icon to your HTML application. Here's the syntax that lets you add an iPhone app icon to your web app:

iPhone HTML apps status bar FAQ: When creating an iPhone web app so it looks more like a native iPhone app, how can I control the iPhone status bar color?

Once you've removed the iPhone Safari browser URL bar, the next thing you can do to make your HTML web app look more like a native iPhone app is to control the iPhone status bar. The status bar is the bar at the top of the iPhone screen.

iPhone HTML web app FAQ: In an HTML web app optimized for the iPhone, how do I remove the URL bar on top of the iPhone Mobile Safari web browser so I can show my HTML app in full screen mode?

When you're creating an HTML/web app to look like a native iPhone app, one of the things you'll want to do is remove the URL bar in the Mobile Safari web browser. This is the URL bar on the top of the iPhone browser, and by getting rid of it, you can display your web app on the iPhone in full-screen mode.

iPhone HTML page size FAQ: In an HTML web app optimized for the iPhone, how do I set the page size to be the optimal iPhone page size (iPhone page pixel width)?

By default the iPhone assumes HTML pages are 980 pixels wide. When you're creating a custom iPhone HTML app, you really want to control this page size so your web app will look better.

The way you change the iPhone HTML page size (pixel width) is to use the special iPhone HTML "viewport" meta tag, like this:

PHP date validation FAQ: How do I validate a date in PHP?

This is a little bit of a tough question because you'll probably want more than the basic PHP date validation technique. For instance, to check a person's age you'll probably want to include a limited range of years, and to check something like a credit card expiration date, you'll want to make sure the date is in the future.

That being said, the basic PHP date validation technique is to use the checkdate function, like this:

A long time ago a friend gave me a copy of a book named "The Design of Everyday Things", and that's when I first heard of "Norman Doors".

Summary: A Drupal jQuery mobile tutorial/demo.

As I wrote yesterday, I just started working on a mobile Drupal app (web app) that uses jQuery Mobile to make the app look and function like a true mobile app. Yesterday's article was about creating a Drupal mobile theme using jQuery Mobile.

I didn't get a chance to work on this any more today, but I thought I'd share a couple of screenshots from this Drupal mobile web app to show you what I'm doing.

MacBook Air carrying cases and sleeves: I recently bought a MacBook Air, and while there are a lot of nice things about it, an unusual thing about it is that it creates a dilemma about how to carry the thing around. Do you use a sleeve, carrying case, laptop bag, or something else?

My old laptop bag is much too big and cumbersome for the Air, so that doesn't work.

Drupal jQuery Mobile FAQ: How do I get started developing a mobile Drupal app using the jQuery Mobile project?

In an attempt to create a mobile Drupal iPhone app, I'm currently writing a Drupal mobile app using jQuery Mobile, and although I still have a few kinks to work out, the basics are now working.

MAMP website setup FAQ: How do I configure MAMP and my Mac so I can develop a new PHP website? (Or, Can you share a Mac MAMP setup tutorial?)

Assuming you already have MAMP installed, creating a new MAMP website is pretty easy. I've gotten to the point where I can do it in about two minutes. You just have to configure your /etc/hosts file and your MAMP Apache configuration file. Here's how.

Drupal iPhone mobile themes, special introduction: In this article I take a quick look at the existing Drupal iPhone themes. The reason I say this is a "quick look" is because none of the themes seemed to work very well out of the box. This is a bummer for me, not only because I have a lot of work to do, but because I normally like to share solutions to problems.

Drupal database configuration file FAQ: Is there something I can do to quit having to change my Drupal settings.php file every time I go from my Development Environment to Testing and Production?

Yes! One of the things I didn't like about Drupal when I first started working with it was the settings.php file in the sites/default directory. I thought that was THE database configuration file, and you had to keep changing it when you went from Development to Testing to Production.

Drupal 6 SQL insert FAQ: Can you share an example of how to write a Drupal 6 SQL insert statement?

There are at least two ways to write a SQL insert statement in Drupal 6, and I'll demonstrate both of those here.

A Drupal 6 SQL INSERT example using db_query

The first method involves writing an old-fashioned SQL INSERT statement with the Drupal 6 db_query function, like this:

A Java xeyes solution - I started working on my Java speech recognition app again today, and in the process I saw some source code I thought I should post here. When I was developing this app, I thought it would fun to put a GUI on it, and when I thought about what sort of GUI it should have, I thought of the old X-Windows xeyes app. I looked around to see if anyone had written a "Java xeyes" application, but from what I've seen, nobody has.

Drupal menu nesting problem: I just had a problem with menu nesting while developing a Drupal 6 module, and thought I'd share the problem and solution here.

The problem was that in developing my Drupal module, I was trying to created a nested menu structure, something like this:

- My App
  - Reminders
    - Add Reminder

Somewhere in the process of developing my module, this Drupal nested menu got out of sync, and my menus appeared in a flat structure, like this:

MacBook trackpad stiffness FAQ: My new MacBook trackpad is too stiff and hard to click, is there something that can be done about this?

As the owner of a new MacBook Air, I agree, the MacBook trackpad is too stiff. It's annoying to have to "click" something that's this hard to press.

After digging around into this MacBook "trackpad is too stiff" issue for a little while, I've found several possible solutions, which I'll share here.

Mac Stickies backup FAQ: I want to make sure my Mac Stickies are backed up; where are the Mac Stickies files (or database) located?

As I wrote about in an earlier article on How to save Mac Stickies, Mac Stickies (sticky notes) are saved in one database file. This file is named StickiesDatabase, and it's located in the Library folder of your home directory.

As an example, my home directory is named /Users/Al, and my Mac Stickies database file is located in this directory: