Archive for 2008

May 14 2008

Login Screenshot Challenge - Part 2

Published by john under System

In Part 1 of this series I described my attempts to get a screenshot of the login screen on Mac OS X. The attempts included using hotkeys, Grab application, fast user switching and putting the system to sleep and using the terminal utility ’screencapture.’ All to no avail.

There were several ideas shared by others, including using cron, apple remote desktop and ssh. Again, good intentions, however, no luck.

I was able to dig up one approach that get that gets us 99% of the way there. From a terminal, I can enter the following, where I specify the login name using the switchToUserID parameter:

/System/Library/CoreServices/”Menu Extras”/User.menu/Contents/Resources/CGSession -switchToUserID `id -u root`.

The last parameter `id -u root` uses the terminal command id to convert a user name to a number. Upon running this command, a login window is popped up for the login id specified, see the figure below.

If I change the login id to another user, the login window changes as well:

The 1% that remains is that what I really hope to capture is the login window where all available login ids are shown.

There is a related command (below) that displays the login window I am after, however, this brings me back to the same problem I started with, that is, no means to get a screenshot.

/System/Library/CoreServices/”Menu Extras”/User.menu/Contents/Resources/CGSession -suspend

With some further digging I was able to successfully get the screenshot that I’m after with a couple of approaches:

  1. Using a screen recording program such as ScreenFlow: enable fast user switching, start the recording and select the login window option from the fast user switching dialog. This will capture the sequence of events including the elusive login window.
  2. I also found a few screenshot applications that can successfully capture the login window while running in the background. For example, Christian at MonkeyBread Software wrote a freeware application in REALbasic TimedScreenshot (here’s the source code) that will capture the screenshot I am after:

So, it’s obvious we can get there from here. The question that remains is, what system level API/library can we call to make this happen?

Ideally I’d like to have a very simple application, written in as few lines of code as possible, using tools that are freely available (e.g. Xcode or even better, just terminal commands). If this involves running a program in the background using a terminal command such as sleep (as I did with screencapture in the previous post), that works for me.

Any developers (Cocoa or otherwise) who can take this challenge the last mile?

Technorati Tags: ,

No responses yet

May 13 2008

Reading Email as Plain Text

Published by john under Defaults

Well, I haven’t given up on the mission to determine how to capture a screenshot of the login screen in Mac OS X. Read more here. In fact, I’ve been able to create a popup login window with a user name and capture a screenshot, however, it’s not exactly what I’m looking for. More to come…

In the meantime, I want to share a tip if you tire of email messages in iMail where the body of the message has been created in rich text. I’ve got a trick for you to turn email that looks like:

to email that looks like this:

Ah yes, good old plain text. Here’s the trick, from a terminal type the following:

defaults write com.apple.mail PreferPlainText -bool TRUE

That’s all there is to it. And of course, if you change the TRUE to FALSE, you’ll be back in the world of colorful, formatted messages.

Technorati Tags: ,

No responses yet

May 12 2008

Login Screenshot Challenge - Part 1

Published by john under System

In my last post I was showing various options for working with the root account. Near the end of the post I was planning to show how when logging in as root, the login dialog does not offer root as one of the available login names.

Attempting to capture the login screen has been an interesting diversion. Up to this point I’ve been unsuccessful in capturing the elusive screenshot.

So here’s a challenge for you…can you be the first to figure out how to capture a screenshot of the login screen for the root account? There are a couple of ground rules:

  1. You must be running Leopard (or at a minimum, the solution must work on Leopard).
  2. I’d like this to be a “free” solution, as in, no software to buy.
  3. Finally, I am looking for a solution that doesn’t require more than one Mac (e.g. using SSH from one Mac to another).

To save you some time, I’ve listed below the options I’ve tried:

Attempt #1 - Hotkeys
From the login screenscreen, I tried the following hotkeys:

- Shift+Command+3 (capture entire screen to file)
- Control+Shift+Command+3 (capture entire screen to clipboard)
- Shift+Command+4 (capture area defined with mouse to file)
Each of the above greeted me with a pleasant beep, nothing more.

Attempt #2 - Grab application
My next attempt was to try the timed capture option with the Grab application. Seemed like a clever idea, however, when I started the timer and logged out (to get to the login screen), Grab just seems to quietly go away. No warning, no error, no screenshot.

Attempt #3 - Fast Switching
Next, I enabled fast user switching. My thinking was, maybe if I don’t logout per se, and request the Login Window (see the figure below) that the login screen might somehow be different (as in, something I can capture using hotkeys):

Seemed logical, however, first notice that the root account doesn’t show up in the list of available accounts. Next, upon choosing Login Window I was shuffled over to the same login screen as if logging out. No luck.

Attempt #4 - Getting a little more creative, I tried this from within a terminal:

screen -d -m bash -c “sleep 30; screencapture /Users/John/login.png”

This option uses a screen manager (more on that in an upcoming post) and calls the screencapture application after sleeping for 30 seconds. Once I ran this option from a terminal, I quickly logged out and patiently waited…I heard the camera sound of the screencapture application and was psyched, “yes!”…I navigated to my home directory and located the file login.png…I opened the file with the Preview application…and much to my dismay…it was an image alright…a big, black, blank image. So close, but no cigar.

So, now it’s up to you. Can you figure what it takes to capture the login screenshot? You can submit your idea as a comment (below) or drop me an email. And please verify your trick works with Leopard, as other published solutions I’ve found seem to work only on releases prior to Leopard.

I’m doing my best to see if I can find a volunteer to donate a prize (software, book, t-shirt, etc). If that doesn’t come through, what I can offer is a little lime-light, blog style. If you are the first to contact me with a solution (within the parameters above), we can collaborate on a post where you can tell the world how you got so smart :) and share your bio, picture, blog/website, etc.

If anyone reading is interested in donating a prize, contact me and we’ll get the ball rolling.

I am very intrigued to see if/how this can be done.

Technorati Tags: ,

8 responses so far

May 09 2008

Working as Root

Published by john under System

Root is the uber system account. Although handy at times (for example when installing applications), it’s generally recommended that root not be used as your everyday login. What follows are some options for working as root.

If you need to run a command as root, you can use the sudo command. For example, to run the script for daily system maintenance, you can run this command (the $represent the terminal prompt):

$ sudo periodic daily

Now that’s all well and good, however, it’s generally applicable only for one command. What if you are in a terminal and want to login as root to do some larger scale maintenance or system work? Try this:

$ sudo -s

This command will enable the root account and update your prompt as shown in the figure below:

The above screenshot assumes you are using the bash shell and have admin rights on the account you are logged in with. The $ typically represents a user account whereas # represents root.

The last option is to create/enable a root account, thus you can login (when restarting/rebooting) as root. This approach offers the most flexibility and power, however, use with caution as there are no limits to what (damage) you can do.

Root account option #1: Enter the following from a terminal:

$ dsenableroot

You’ll be prompted for your (current) password, as well as the new root password.

Root account, option #2: Enter the following from a terminal:

$ sudo passwd

You’ll be prompted for the same series of passwords as above.

Root account, option #3: Follow the steps below:

- Start the Directory Utility application (/Applications/Utilities/Directory Utility)
- Click the lock icon in the lower left corner (to unlock it)
- From the Edit menu (across the top of screen), select Enable Root User

To wrap up this post I was planning to show you how the login window changes when a root account is enabled. Unlike other accounts on your system where a name is typically displayed as one of the login options, the root account is not listed as one of the options (for security reasons).

However, getting a screenshot of the login screen is a considerable feat. This is a great segue to a post coming next week where I’ll show the tricks that I tried for capturing the elusive login screen and I will pose an intriguing challenge for you…

Technorati Tags: ,

No responses yet

May 07 2008

Dashcode 2, Beta

Published by john under Dashcode

If you are interested in working with the next beta of Dashcode, although there is no public announcement of the beta, it is available, read on for the details…

If you are not familiar with Dashcode, it’s a development tool created by Apple for building Dashboard widgets. The 1.0x release was bundled with Leopard. Dashcode is an impressive application, with drag-n-drop support and a no-coding option for creating a widget. Of course, as with any “no coding required” statement there is the unstated disclaimer that there are limitations on how far you can take a widget without digging into some code. And on that note, Dashcode offers excellent support for both writing and debugging code that make up a widget (CSS, HTML and JavaScript).

To give you an idea of what you can do with Dashcode, the widget below is an RSS feed of this blog that was created with version 1.0x.

You can try Dashcode 1.0 if you are running Leopard by installing the developer tools on the Leopard install DVD.

Interested to try the 2.0 Beta? There isn’t a download solely for Dashcode, however, if you download the iPhone SDK, Dashcode is one of many tools included in the download. If you do not have an Apple ID, follow the link near the bottom of this page to download the iPhone SDK, where you’ll find an option to create an ID.

Important note: if you import a 1.0 project into the beta, be aware that you might be able to work in the project with 1.0 if you save the project. To get around this, save any imported project with a new name (and/or location). An additional suggestion is to install the iPhone SDK in a different directory than the default /Developer. I opted to install the beta into /Developer/Beta such that I can use both versions of the tools.

In a screencast to follow, I’ll show you how I created the widget above with Dashcode 1.0.

Technorati Tags: , ,

No responses yet

May 06 2008

Converting Images Types

Published by john under Tools/Utilities

I continue to find the Preview application to be a handy little tool. It’s not that Preview supports an enormous feature set for working with images, as much as each time over the last few months that I’ve look to the Previewer to help me out, it did.

The first time this came about I simply needed to resize an image to post on this blog - from the Tools menu, click Adjust Size and save the file, that’s it, done (and of course it can preserve the aspect ratio). My most recent encounter was when I needed to convert a file type from JPG to GIF. Again, a few clicks and it’s done - open an image, from the file menu choose the Save As option and from the dialog box select the image type. The figure below shows the supported file types; notice you can even save an image as a PDF.

By no means a full-fledged image editing program, and never intended to be, Previewer is still much more than its name suggests.

Technorati Tags: ,

No responses yet

May 05 2008

Google App Engine, Free Preview

Published by john under Web

Google App Engine provides an opportunity to leverage Google’s infrastructure for server side web applications. The platform is built on a Python runtime, includes persistent storage as well as the capability to integrate with existing Google applications (think Google Maps, Gmail…).

The App Engine SDK is an open source project that is hosted on Google code, you can can access the project here. A download of the SDK is available for Mac here.

The App Engine SDK includes a web-server application that provides a means to emulate the App Engine services from within a local development environment. Once deployed, applications can be hosted on the appspot.com domain, or your own domain.

The video below is a good introduction to Google App Engine from a recent CampFire One event:

One of the more intriguing aspects to services like the Google App Engine is that you focus on the application, not the hosting/scaling. Should you build a killer app, your focus still lies on the application itself, not on how to massively scale (which would be a good problem to have). From the App Engine homepage

This is a PREVIEW RELEASE of Google App Engine. For now, account registrations are limited to the first 10,000 developers, and applications are restricted to the free account limits.

Hurry and give it a go…

Technorati Tags: ,

No responses yet

Next »